Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access syntax "GoToControl" 1

Status
Not open for further replies.

docjohn52

Programmer
Sep 28, 2002
114
US
I'm a VB programmer trying to help a friend's db.

I have written a routine to copy the results of a subform
to a textbox on another form.

The error says "must have focus"

Access help says:
"To run the GoToControl action in Visual Basic, use the GoToControl method of the DoCmd object. You can also use the SetFocus method to move the focus to a control on a form or any of its subforms, or to a field in an open
able, query, or form datasheet."

I can'r find the exact syntax to use either gotocontrol or setfocus used anywhere.

DoCmd doesn't have an example either...

Can anyone help, or wrong forum?

Thanks

John
 
You're probably using the .Text property of the control, which is usual in Classic VB. In Access VBA, one refer to the control by using it's .Value property, or don't specify property at all, as the .Value property is default.

[tt]Me!txtSomeControl.Value = <something>[/tt]

If you need to set focus, drop the DoCmd thingie, and use

[tt]Me!txtSomeControl.SetFocus[]

Roy-Vidar
 
That seems to work like a champ, thank you sir! Have a star on me!

john :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top