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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.GoToControl problem

Status
Not open for further replies.

CCSC0208

Technical User
May 16, 2003
22
US
Hello,

I am new in VBA. I took some codes from one database, but something doesn't work.

In a Form view, on VarB field, on Exit, a function will check a condition. After entering the value of VarB and clicking Enter key, if the condition is false, I want the cursor stays in VarB field. The following code works in the database where I took the codes, but it doesn't work in my database. Could somebody help me check this? Thank you for your time.


If Condition = 6 Then
VarA = VarB
Else
MsgBox "Please do again!"
DoCmd.GoToControl VarB
End If
 
Have you tried VarB.setfocus instead of the gotocontrol?
 
I tried "VarB.SetFocus" instead of "DoCmd.GoToControl VarB". It works in the database where I took the code from, but it still doesn't work in my database. Is there any difference between Access97 and 2002 at this point? Any restriction? This field is visible and enabled.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top