Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro Automation & ODBC Driver Connect

Status
Not open for further replies.

bkf7911

MIS
Mar 20, 2007
83
US

I've got a database that contains a macro I'd like to put on a scheduler to have run overnight, but my current code isn't set up to get past the "Oracle ODBC Driver Connect" prompt that i'm receiving. The following is the code i've rewritten to work with my current project.

How could this be modified to include sending the "Service Name", "User Name" and "Password" for the ODBC prompt?


****************
dim o

set o=createobject("Access.Application")
o.automationsecurity=1
o.opencurrentdatabase "C:\Documents and Settings\Desktop\WS - DB1\DB1.mdb"
o.usercontrol=true
o.docmd.runmacro "Import"
o.CloseCurrentDatabase
o.Quit

set o=nothing
 
This is what I use
In your macro use RunCode - Establish_Connection()

Public Function Establish_Connection()
Dim db As Database
Dim dbcurr As Database
Dim ds As Recordset
Set dbcurr = CurrentDb()
'Logs on to Your Database
Set db = OpenDatabase("", dbDriverComplete, False, "ODBC;DSN=YourDSN;DB=YourDbName;HOST=YourHostName;SERV=YourSetting;SRVR=YourServerName;PRO=onsoctcp;UID=YourUsername;PWD=YourUserPassword")
End Function

RGB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top