M
mlkiser via AccessMonster.com
Bah, VBA is becoming very frustrating. Simple taks seem anything but. I am
trying to do some very simple verification tasks when my users enter a social
security number. They enter the social in a text box called txtSSAN. If the
social is found, it autopopulates the name, email and phone number. Works
great. If it isn't, my code gives them an error message and clears the data.
That part works great. WHen it is done doing that, I simply want the cursor
to return to the txtSSAN box. But I can't get the darn thing to move there.
Here is the working code snipet:
Err_Null:
MsgBox "SSAN Not Found. Please ensure you did not enter dashes and try
again.", vbOKOnly + vbExclamation
Me.Undo
Exit Sub
I have tried adding the following after the Me.Undo statement and not one of
them has moved the cursor where I want it.
Me.txtSSAN.SetFocus
[txtSSAN].SetFocus
Forms("MyForm").txtSSAN.SetFocus
I don't understand why the cursor won't return to the right txt box. Any help
greatly appreciated.
trying to do some very simple verification tasks when my users enter a social
security number. They enter the social in a text box called txtSSAN. If the
social is found, it autopopulates the name, email and phone number. Works
great. If it isn't, my code gives them an error message and clears the data.
That part works great. WHen it is done doing that, I simply want the cursor
to return to the txtSSAN box. But I can't get the darn thing to move there.
Here is the working code snipet:
Err_Null:
MsgBox "SSAN Not Found. Please ensure you did not enter dashes and try
again.", vbOKOnly + vbExclamation
Me.Undo
Exit Sub
I have tried adding the following after the Me.Undo statement and not one of
them has moved the cursor where I want it.
Me.txtSSAN.SetFocus
[txtSSAN].SetFocus
Forms("MyForm").txtSSAN.SetFocus
I don't understand why the cursor won't return to the right txt box. Any help
greatly appreciated.