G
Guest
Good day! I copied the code and it works fine, on one of my form because
there is no other underlying field needed (or only one field in
FL_Organism2). But the other form I created for FL_Organism has 2 fields,
(1) Organism (2) Type. once i type-in the new field with its corresponding
type and close this form, the error message that its not in list would
appear. How can i edit this code? thanks very much!
Private Sub Isolate_NotInList(NewData As String, Response As Integer)
Dim strPrompt As String
On Error GoTo Err_NotInList
strPrompt = "'" & Me.Isolate.Text & "' is not in the list." & vbCr & vbCr &
"Do you want to add it?"
If MsgBox(strPrompt, vbExclamation + vbYesNo, "Not In List") = vbNo Then
Response = acDataErrContinue
Me.Isolate.Undo
MsgBox "Please select an item from the list"
Exit Sub
End If
DoCmd.OpenForm "FL_Organism", , , , acFormAdd, acDialog
Me.Isolate.Undo
Response = acDataErrAdded
Exit_NotInList:
Exit Sub
Err_NotInList:
MsgBox "Error" & Err.Number & ": " & Err.Description, ,
"Isolate_NotInList"
Resume Exit_NotInList
End Sub
there is no other underlying field needed (or only one field in
FL_Organism2). But the other form I created for FL_Organism has 2 fields,
(1) Organism (2) Type. once i type-in the new field with its corresponding
type and close this form, the error message that its not in list would
appear. How can i edit this code? thanks very much!
Private Sub Isolate_NotInList(NewData As String, Response As Integer)
Dim strPrompt As String
On Error GoTo Err_NotInList
strPrompt = "'" & Me.Isolate.Text & "' is not in the list." & vbCr & vbCr &
"Do you want to add it?"
If MsgBox(strPrompt, vbExclamation + vbYesNo, "Not In List") = vbNo Then
Response = acDataErrContinue
Me.Isolate.Undo
MsgBox "Please select an item from the list"
Exit Sub
End If
DoCmd.OpenForm "FL_Organism", , , , acFormAdd, acDialog
Me.Isolate.Undo
Response = acDataErrAdded
Exit_NotInList:
Exit Sub
Err_NotInList:
MsgBox "Error" & Err.Number & ": " & Err.Description, ,
"Isolate_NotInList"
Resume Exit_NotInList
End Sub