WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Access

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Control Access Forms


Regarding: control of Access forms - here's something that works rock-solid foolfproof ... Assuming Access is running (if it weren't, you would not be trying to manipulate an Access form) ...

 accObject = ObjectGet(, "Access.Application")
 formObject = accObject.forms("name_of_target_form_in_quotes")

 ctrlObject = formObject.controls("Name_of_target_textbox1_in_quotes")
 ctrlobject.value = "New String for Textbox1"
 
 ctrlObject = formObject.controls("Name_of_target_textbox2_in_quotes")
 ctrlobject.value = "New String for Textbox2"
 
 ;etc
 
ctrlObject=""
formObject=""
accObject=""
exit
 
 
You have to know the Access Name of the form and of the controls.

If you don't you can use an ordinal number instead of a name, but you will have to experiment to find out what number corresponds to the form/control you want.

Once you find the number you can't depend on it always being the same, so run a line of code something like ...

message ("Form Name Is",accObject.forms(9).name)
to give you the name. Use the name in your code from then on .
Article ID:   W17141
File Created: 2007:07:03:14:28:26
Last Updated: 2007:07:03:14:28:26