Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clicking command button in accesss form
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
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:

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]"
'This is where I need help[/b]

Thanks,
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Use the sendkey method to bring focus on the Ok button and then click on it..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to catch the script execution when QTP scripts are executed from command line Sreeni.lutukurthy 0 2,943 03-19-2015, 05:55 PM
Last Post: Sreeni.lutukurthy
  QTP not clicking on the flex button sudheerch 2 3,623 12-03-2013, 12:56 PM
Last Post: sudheerch
Wink How to read text in command prompt using QTP Sourabh146 1 6,625 11-30-2013, 11:02 AM
Last Post: ravi.gajul
  How to write In PDF Form using QTP anukapoor 3 5,525 04-05-2012, 06:00 PM
Last Post: atulparate
  QTP cannot recognize a web form inside SAP QTP_Gaspar 2 4,323 01-13-2012, 12:19 AM
Last Post: QTP_Gaspar

Forum Jump:


Users browsing this thread: 1 Guest(s)