Set focus Broke - Run-Time Error 2110

N

NNLogistics

I am a fairly new at access. In General I thought I was making progress. I
was close to releasing this application and was making some final changes.
It
seems that things that worked before dont work anymore. Example: form a
combo box on 'on enter' event.





Private Sub cmboChooseWarehouseAfterRepair_Enter()
If Not IsNull(Me.txtDateReturnedtoVHO) Then
MsgBox ("You cant have a value for 'Which Warehouse after Repair' and 'Date
Returned To VHO'")
Me.txtPassFailInspection.SetFocus
ElseIf IsNull(Me.txtDateRepairComplete) Then
MsgBox ("You must have a 'Date Repair Complete' before you enter a
Warehouse")
Me.txtDateRepairComplete.SetFocus
End If

If I enter the cmboChooseWarehoseAfterRepair textbox with no date in 'Date
Repair Complete', I get the message box with the verbage I used - fine.
Then
I get a run-time error 2110 " Microsoft cant move focus to control
'txtDateRepairComplete' I tried moving the focus to another txtbox - same
problem. I believe that this worked before and I dont know when or why it
broke.
The same general problem with set focus is occurring in other objects.

Thanks, I'm getting fustrated
 
R

Rick B

Personally, I do this type of checking in the "EXIT" event for the field.
If I find that the criteria is not met, I stop the program from Exitting the
field by using the line

CANCEL=TRUE

In the IF statement where I locate the problem.

This "cancels" the "exit" event (in other words, it keeps the focus where it
is.).

Rick B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top