Set focus doent work anymore

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





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 it broke.
The same general problem with set focus is occurring in other events.

Thanks, I'm getting fustrated
 
G

G. Vaught

Its not clear under which event you are executing this code. If you have
this under a combo box , then I believe you will get the error you are
getting. Your code should be in the after update for the field in which you
are checking.
 
N

NNlogistics

It is in the "on Enter event' of a combo box. I want the user to be aware
that as soon as he tries to enter someting in this field - he/she should have
entered something in another field(txtDateRepairComplete) first.

Are you saying that you cant initiate a setfoucus from a combo box?

Thanks for the feedback
 

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