Paul Cooke
Registered User.
- Local time
- Today, 10:57
- Joined
- Oct 12, 2001
- Messages
- 288
Hi guys could someone please point me in the right direction to "fix" this code please. I have tried my best to do it but I don't really know what I'm doing to be honest ..Im just reading other code for tips and hoping it works !!
when I click 'cancel' on the 1st msgbox everything works fine it goes back to the combo. If I click 'ok' the 2nd msg box comes up no problems but when I click 'ok' on that one the 1st msgbox comes up again.
I then click 'ok' on that and the 2nd msgbox comes up again I click 'ok on that and I get a runtime error the close action was canceled.
I keep changing the docmd close line but nothing seems to work
I would be very grateful for any advice or help you can offer
Many thanks
when I click 'cancel' on the 1st msgbox everything works fine it goes back to the combo. If I click 'ok' the 2nd msg box comes up no problems but when I click 'ok' on that one the 1st msgbox comes up again.
I then click 'ok' on that and the 2nd msgbox comes up again I click 'ok on that and I get a runtime error the close action was canceled.
I keep changing the docmd close line but nothing seems to work
I would be very grateful for any advice or help you can offer
Many thanks
Code:
Private Sub cboProductionEmployerDetailsID_NotInList(NewData As String, Response As Integer)
intAnswer = MsgBox("The Production or Employer " & Chr(34) & NewData & Chr(34) & _
" has not been stored in the database yet. Are you sure the spelling is correct? If incorrect please click Cancel and try again." _
& vbCrLf & "" & vbCrLf & _
"If spelling is ok and you are with the patient now. Please complete a paper treatment form." _
& vbCrLf & "" & vbCrLf & _
"If inputing from a paper treatment form, please stop the entry and contact me.", vbOKOnly + vbOK, "Unknown Production Or Employer Name")
If intAnswer = vbOK Then
MsgBox "The unknown Production or Employer has not been added to the database.", vbInformation, "Confirmation"
DoCmd.Close acForm, "TreatmentForm"
DoCmd.OpenForm "Form1"
Response = acDataErrContinue
Else
MsgBox "Please select a valid Production or Employer name from the list.", vbInformation, "New Data Not Added"
Response = acDataErrContinue
End If
cboProductionEmployerDetailsID_NotInList_Exit:
Exit Sub
cboProductionEmployerDetailsID_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboProductionEmployerDetailsID_NotInList_Exit