Hello,
Have been trying to enter data automatically to an Access97 mde file using Excel VBA. And have hit my next wall. When file opens, FrmLogin activates. the OK button must be clicked for db to proceed to next step(some macros run). The code below is what I am using so far. I have changed the focus on form to the OK button, but cant figure out how to send a command to activate OK button. Manually I either "left click on it" or depress "Enter" key. I want to automate this operation with VBA. I have tried a sendkey statement, but probally am not using the right syntax.
The following code: DoCmd.Close acForm, "FrmLogin", acSaveYes
closes form just fine, but doesn't run the macro that activates when OK button is used. Any help appreciated.
Thanks,
Cliff
Dim db As Access.Application
Sub test_opendb()
Set db = New Access.Application
db.OpenCurrentDatabase "c:\Program Files\opsnet\Opsnet20.mde"
db.Application.Visible = True
Forms!FrmLogin!OK.SetFocus
End Sub
Have been trying to enter data automatically to an Access97 mde file using Excel VBA. And have hit my next wall. When file opens, FrmLogin activates. the OK button must be clicked for db to proceed to next step(some macros run). The code below is what I am using so far. I have changed the focus on form to the OK button, but cant figure out how to send a command to activate OK button. Manually I either "left click on it" or depress "Enter" key. I want to automate this operation with VBA. I have tried a sendkey statement, but probally am not using the right syntax.
The following code: DoCmd.Close acForm, "FrmLogin", acSaveYes
closes form just fine, but doesn't run the macro that activates when OK button is used. Any help appreciated.
Thanks,
Cliff
Dim db As Access.Application
Sub test_opendb()
Set db = New Access.Application
db.OpenCurrentDatabase "c:\Program Files\opsnet\Opsnet20.mde"
db.Application.Visible = True
Forms!FrmLogin!OK.SetFocus
End Sub