run MS Access macro on current access process without opening again - ms-access

I have an access database that connects to multiple sql server databases using windows authentication. Before opening this access database, I have to use the 'runas' command in command line to run the application as a different domain user, which is the same domain as sql server. Now I need the ability to schedule reports from the access database at certain times and I know I can do this using task scheduler, which will always open the database first. This doesn't work for me since I can't automate the 'runas' command since I'll always be prompted for a password.
Is there a way to run a script to run the access macros on my access database that is currently open (on an existing process)? For example, if I need to send 3 reports throughout the day, could the script be called from task scheduler to run the Access macros on the current instance and not open up a new instance.
Thanks
AJ

Related

SSDT goes into not responding when checking new SSRS query using a linked server

This particular SSRS query that uses a linked server from the main database takes VS SSDT into a "Not responding" state when refreshing the fields. All other SSRS queries using the same main database only work fine, so I'm assuming there's a permission issue along the way executing DDL on the linked server. The issue is that running a DDL on the linked server from my account on SSMS works fine. So I have permissions. The data source on the report is also using my account doing windows authentication. Anyone knows what user SSRS impersonates to execute the DDL on a linked server?
Thank you

Running MS Access VB Module from ArcCatalog

I created some VBA code that runs a make table query in MS Access. Whenever the MS Access database is opened it automatically runs the SQL and updates the table.
I then created a database connection in Arcatalog to the MS Access database where I can link to the MS Access .accdb file and add the table to ArcMap.
When I have items linked in ArcMap with the db connection I get the .laccdb extension along with the .accdb extension. I was hoping that since arcatalog was linked to the access database that this would trigger the VBA code and re-run the code and update the linked table in ArcMap without having to go into the Access database each time.
I noticed that in the VBA editor window I can click on some ESRI references.
Is there any line of code that I can add that will make the access database run once it is initialized by ArcCatalog via the database connection that I have set up utilizing any of these ESRI references libraries that I see in MS Access?
thanks

Visual Studio 2013 - execute Model.edmx.sql trough MySQL?

I'm learning the way ADO.NET Models works in Entity Framework with MySQL. I Generate new test model and then select "Generate Database from model"
It produce for me new file "model_name.edms.sql" - actual MySQL script for database creation.
However to execute it I have to "Connect to Server" which by default comes as SQL Server 2012. but in my case I use MySQL and not MS SQL Server. I dont have SQL12 instance, im working with MySQL
How do I change it to connect to MySQL?
P.S. I know I can use "New Query" directly on database and copy / paste content of the file and execute. also I can use MySQL Workbench and tons of other applications, however im working in VS2013 where most of the tools already integrated, I cant believe that SQL files in VS13 can be executed only trough MS SQL12
I've just ran into the same problem and that's how to solve it.
I'm using VS 2010 Ultimate but I guess it's the same in VS 2013.
First, when you connect (and execute the sql) from the toolbar you actually request to do it on the 'Transact-SQL Editor' toolbar, which means that the toolbar handles the MS databases. That's why you ALWAYS get a connection dialog to MS databases.
If MySQL package is properly installed in VS (and apparently that's the case for you) you should:
Right click any existing toolbar (or go to View->Toolbars) and select MySQL. This should add the MySql Toolbar.
Click on the first button from the left (in 'MySQL Toolbar') to either connect to an existing Data Connection or create a new connection to your MySql DB. A MySql script tab will be added.
Copy all the sql generated from the EDMX file to the 'MySql script tab'.
Run the script from the 'MySql script tab'.
That should do it.
I know there's still a little copy-paste involved but at least you don't have to leave VS.
Hope that helps
cheerio
First, you have to be sure that you have downloaded MySQL for Visual Studio. This is NOT Connector/Net (though you should probably have that, too).
In VS, when you open Server Explorer, you should be able to add a database. Input your server name, user name, password, and don't forget to click the Advanced button and add in your port (usually 3306). All of this information can be obtained from your MySQL Workbench. Now you should be able to deploy your EDMX to your MySQL database using the same steps you would use for SQL Server.
Full steps from Oracle can be found at http://dev.mysql.com/doc/connector-net/en/connector-net-visual-studio-making-a-connection.html.
EDIT: Once you've performed the steps above, right-click in a blank space of your EDMX and choose SSDLToMySQL.tt in the dropdown on the DDL Generation Template. SSDLToSQL[version].tt is the default choice.
If you rename the whatever.edmx.sql file to whatever.edmx.mysql it will open in the proper tool and allow you to connect to your MySQL database server and run the script.
Perhaps at some point the generator will be updated to create the EDMX file with the ".mysql" instead of the ".sql" file extension to begin with.

ODBC connection report for Crystal Report not working on other machines

SETUP
I am currently running on Crystal Report 2011.
I have created a Crystal Report that pulls data from a MySql database. I had to setup an ODBC connection in the Data Source wizard under Admin Tools. I created the report and saved it. I then opened it up in a report view and it worked fine.
PROBLEM
When i try to run the report on another computer, it gives "Failed to open a Connection". I setup the ODBC connection on the other computer.
QUESTION
Does anyone know how to make it so i can deploy a Crystal Report using MySql tables to other machines?
Based on your original question, it sounded like you had trouble accessing a MYSQL db from a different node (server), and my suggestion was to make sure that user and node were entered into MySQL's user table. I happen to use the grant directive to do this.
MySQL's access is user/ip-address based, whereas MS SQL Server is either server login (sa or other users) or Windows domain login based. Although an Microsoft SQL Server expert would call these two login approaches using more correct terminology, these approaches are slightly different than MySQL's approach.

Create Sql Server Backup on Local Machine

I am using SQL Server Management Studio running on my local machine.
I can log on to a remote box (database engine) and use the
Studio to create a database backup which is saved to a drive on the remote box.
How do I get it to save the backup to a drive on my local machine?
See this MSDN article, for the section on backing up to a network share, e.g.:
BACKUP DATABASE YourDatabase
TO DISK = '\\SomeMachine\Backups\YourDatabase.Bak';
Backing Up to a File on a Network
Share For SQL Server to access a
remote disk file, the SQL Server
service account must have access to
the network share. This includes
having the permissions needed for
backup operations to write to the
network share and for restore
operations to read from it. The
availability of network drives and
permissions depends on the context is
which SQL Server service is running:
To back up to a network drive when SQL
Server is running in a domain user
account, the shared drive must be
mapped as a network drive in the
session where SQL Server is running.
If you start Sqlservr.exe from command
line, SQL Server sees any network
drives you have mapped in your login
session.
When you run Sqlservr.exe as
a service, SQL Server runs in a
separate session that has no relation
to your login session. The session in
which a service runs can have its own
mapped drives, although it usually
does not.
You can connect with the
network service account by using the
computer account instead of a domain
user. To enable backups from specific
computers to a shared drive, grant
access to the computer accounts. As
long as the Sqlservr.exe process that
is writing the backup has access, it
is irrelevant whether the user sending
the BACKUP command has access.
STEP 1 : From sql-server 2008 connect to remote server
STEP 2 : Right Click server database
STEP 3 : Select Export Option
STEP 4 : Follow Instructions, Import to local server database and Backup from Local database
In Microsoft SQL Server Management Studio you can right-click on the database you wish to backup and click Tasks -> Generate Scripts.
This pops open a wizard where you can set the following in order to perform a decent backup of your database, even on a remote server:
Select the database you wish to backup and hit next,
In the options it presents to you:
In 2010: under the Table/View Options, change 'Script Data' and 'Script Indexes' to True and hit next,
In 2012: under 'General', change 'Types of data to script' from 'Schema only' to 'Schema and data'
In 2014: the option to script the data is now "hidden" in step "Set Scripting Options", you have to click the "Advanced" and set "Types of data to script" to "Schema and data" value
In the next four windows, hit 'select all' and then next,
Choose to script to a new query window
Once it's done its thing, you'll have a backup script ready in front of you. Create a new local (or remote) database, and change the first 'USE' statement in the script to use your new database. Save the script in a safe place, and go ahead and run it against your new empty database. This should create you a (nearly) duplicate local database you can then backup as you like.
If you have full access to the remote database, you can choose to check 'script all objects' in the wizard's first window and then change the 'Script Database' option to True on the next window. Watch out though, you'll need to perform a full search & replace of the database name in the script to a new database which in this case you won't have to create before running the script. This should create a more accurate duplicate but is sometimes not available due to permissions restrictions.
You can't - the remote machine has no information about your local machine's setup and cannot see the drives on it. You'd have to setup a shared folder on your local machine, and make sure the remote machine has access to it (which will mean both the SQL Server Agent and SQL Server services on the remote machine will need access to it via domain accounts).
If the remote machine is on the same network as your machine, see AdaTheDev's answer.
Otherwise you'll have to RDP or FTP into the remote machine and transfer the backup manually. I recommend 7-zip'ing it by the way.