loop statement

gbanks

Registered User.
Local time
Today, 11:27
Joined
Feb 9, 2000
Messages
161
Either I'm tired or dumb.. Not sure which.. But I would like to have the If MsgBox part of this code to loop.. It works fine if you enter the wrong receipt# the first time but then nothing.. Any help is appreciated.. Thanks..
Private Sub HiddenTextbox_KeyPress(Cancel As Integer)
Me.RecordSource = BuildDataEntry()
If Me.RecordsetClone.RecordCount = 0 Then
Cancel = True
If MsgBox("Receipt# Not Found, Click Ok To Enter A New Receipt# Or Cancel To Stop.", vbExclamation + vbOKCancel, "IDC Receipt System Message:") = vbOK Then
Me.RecordSource = BuildDataEntry()
End If
Else
DoCmd.CancelEvent
End If
Exit Sub
End Sub
 
The only way I can see to make your msgbox() loop is to add.

Dim bolSuccess as Boolean
bolSuccess=False

Do Until bolSuccess=True

If MsgBox("Receipt# Not Found, Click Ok To Enter A New Receipt# Or Cancel To Stop.", vbExclamation + vbOKCancel, "IDC Receipt System Message:") = vbOK Then
Me.RecordSource = BuildDataEntry()

bolSuccess=True

End If

Loop
 
thanks.. i'll check it out..
 

Users who are viewing this thread

Back
Top Bottom