|
-
Jul 17th, 2008, 01:10 PM
#1
Thread Starter
New Member
How to reset focus back to vb?
Hi All,
I am a novice at VB and am trying to write a program that will run a MS Access macro. Here's what i have so far...
Dim MSAC As Access.Application
Dim db_name As String
Private Sub Command1_Click()
db_name = "C:\Database.mdb"
MSAC.OpenCurrentDatabase ("C:\Database.mdb")
MSAC.Visible = True
MSAC.DoCmd.RunMacro "Macro1"
SendKeys "password"
End Sub
Macro1 run a series of queries that pulls from an SQL server via ODBC linked tables, which requires login and password.
the problem occurs when the runmacro line executes, the focus is set to MS Access, and VB will not continue to run unless the login and password is entered.
but the purpose of this program is to automate that login process by using sendkeys commands.
How do i reset the focus back to VB so that it will continue to the sendkey commands to MS Access?
Thanks so much
hosackies
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|