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

Error Message needed

Status
Not open for further replies.

cimoli

Technical User
Jul 30, 2010
207
0
0
US
Hi. I would like to have an error message appear if my Form frmReservation combo box field cboLookResID
cannot find a reservationID.

I currently use just the 3 lines that start with the me.refresh in the afterUpdate.
All works fine to retrieve a valid reservationID. However, If I enter a bogus reservationID
into the cboLookResID lookup field, i just get whatever record i was last on. I would like to
get a message saying that the ReservationID cannot be found. I am worried that I will start
typing into an existing unrelated record and mess it up.

Maybe I am close with the code below? Regards, Cimoli.

=============================================================
Private Sub cboLookResID_AfterUpdate()

On Error GoTo Err_cmdLookResID_Click

Me.Refresh
DoCmd.GoToControl Me.ReservationID.Name
DoCmd.FindRecord Me.cboLookResID

Exit_cmdLookResID_Click:
Exit Sub

Err_cmdLookResID_Click:
'MsgBox Err.Description
MsgBox "ResID not found. Please retry."
Resume Exit_cmdLookResID_Click

End Sub

=====================================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top