05-05-2013, 08:47 PM
Hi,
I am trying to automate an application that uses MS Access Forms. I still need what methods are available, currently I am trying to do the login part. I am able to give the username, password & select the DSN then I need to click the [OK] button but that is what I am not able to do. Its a command button from an Access Form, in its Event Property of "On Click" its has a value of [Event Procedure] which if you look at it will bring you to MS Visual Basic and see that it call a procedure to perform. May someone please help me show the syntax or method on how my script be able to control/click this using qtp/vbscript. I mean in terms of manually doing it I just need to click the [OK] button where how will I do this in terms of automation/qtp/vbscript, see my code below:
'This is where I need help[/b]
Thanks,
I am trying to automate an application that uses MS Access Forms. I still need what methods are available, currently I am trying to do the login part. I am able to give the username, password & select the DSN then I need to click the [OK] button but that is what I am not able to do. Its a command button from an Access Form, in its Event Property of "On Click" its has a value of [Event Procedure] which if you look at it will bring you to MS Visual Basic and see that it call a procedure to perform. May someone please help me show the syntax or method on how my script be able to control/click this using qtp/vbscript. I mean in terms of manually doing it I just need to click the [OK] button where how will I do this in terms of automation/qtp/vbscript, see my code below:
Code:
sPathToSample = "C:\Program Files\Application\"
sSampleFilename = "Sample.mdb"
sFilePath = sPathToSample & sSampleFilename
Set oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase(sFilePath)
sFormName = "frmODBCLogon"
Set oForms = oAccess.Forms(sFormName)
sUID = "txtODBCuid"
sPassword = "txtODBCpwd"
sDSN = "cboDSNList"
sOK = "cmdOK"
Set oUID = oForms(sUID)
Set oDSN = oForms(sDSN)
Set oPasswd = oForms(sPassword)
Set oOK = oForms(sOK)
oUID.Value = "username"
oPasswd.Value = "password"
oDSN.Value = "DSN"
[b]oOK.OnClick = "[Event Procedure]"
Thanks,