Sign in to follow this  
Followers 0
Theodoric

MS Access - reading a control

4 posts in this topic

Hi, has anyone had this problem before?

We want to do some testing on a Microsoft Access based application, record response times etc. But of course response time will be a function of the number of records returned by the query.

The database displays a form that has a field displaying the number of records returned. We want to grab the contents of that field and save it in a log file. Problem is that AU3Info doesn't show a control ID for this field. Also you can't tab to the field using the Send() command (it hasn't got a tab stop).

I've searched the forum but can't find anything relevant. The AutoIt help file mentions "AutoIt only works with standard Microsoft controls ...", so I'm assuming this field is one of those 'non-standard' controls.

Any suggestions?

Share this post


Link to post
Share on other sites



Hi, has anyone had this problem before?

We want to do some testing on a Microsoft Access based application, record response times etc. But of course response time will be a function of the number of records returned by the query.

The database displays a form that has a field displaying the number of records returned. We want to grab the contents of that field and save it in a log file. Problem is that AU3Info doesn't show a control ID for this field. Also you can't tab to the field using the Send() command (it hasn't got a tab stop).

I've searched the forum but can't find anything relevant. The AutoIt help file mentions "AutoIt only works with standard Microsoft controls ...", so I'm assuming this field is one of those 'non-standard' controls.

Any suggestions?

It should show a ClassNameNN for the control, try using that in place of controlid


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

It should show a ClassNameNN for the control, try using that in place of controlid

Yes, it does have a ClassNameNN (its 'OKttbx1'). But there are a number of these controls on the form and they all have the same class name!!!

If I use ControlGetText() and use the class name it returns the text from the first control on the form. Unfortunately, the control I need to access is further down the form.

Share this post


Link to post
Share on other sites

I've been dabbling and found a solution myself. This is it ...

; get a link to the MS Access application object
$oAccess = ObjGet("","Access.Application") 
if @error then 
  Msgbox (0,"Access Test","Error Getting an active Access Object. Error code: " & hex(@error,8))
  exit
endif
; link to the form
$oForm = $oAccess.Forms.Item("frmEntry")
; link to the control
$oControl = $oForm.Controls("HowMany")
; get the value !!!
$value = $oControl.Value

MsgBox(48, "Value", $value)

Solved. :o

Havn't tried, but I expect a similar method can be used with other applications where you can link to its COM object.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0