A
Alain
Hi,
I and using the LimitToList Event to be able to add new data if it is not
existing in my table
my problem is the event does not seem to fire at all, the code I wrote is
fine (I think ) and the Limit To List is set to No.
What can cause this problem, I do not even see my msg from my code
On Error GoTo cboCurrency_NotInList_Err
Dim strmsg As String, strSQL As String
strmsg = "'" & NewData & "' is not in the list."
strmsg = strmsg & vbCrLf & vbCrLf & "Click Yes to add to list or No to
not add to list."
If MsgBox(strmsg, vbQuestion + vbYesNo, "Add new currency?") = vbNo Then
Response = acDataErrContinue
Else
strSQL = "INSERT INTO tblCurrency([Currency] VALUES ('" & NewData &
"');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "New currency added to the list", vbInformation, "Iata"
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
cboCurrency_NotInList_Exit:
Exit Sub
cboCurrency_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboCurrency_NotInList_Exit
TIA
Alain
I and using the LimitToList Event to be able to add new data if it is not
existing in my table
my problem is the event does not seem to fire at all, the code I wrote is
fine (I think ) and the Limit To List is set to No.
What can cause this problem, I do not even see my msg from my code
On Error GoTo cboCurrency_NotInList_Err
Dim strmsg As String, strSQL As String
strmsg = "'" & NewData & "' is not in the list."
strmsg = strmsg & vbCrLf & vbCrLf & "Click Yes to add to list or No to
not add to list."
If MsgBox(strmsg, vbQuestion + vbYesNo, "Add new currency?") = vbNo Then
Response = acDataErrContinue
Else
strSQL = "INSERT INTO tblCurrency([Currency] VALUES ('" & NewData &
"');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "New currency added to the list", vbInformation, "Iata"
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
cboCurrency_NotInList_Exit:
Exit Sub
cboCurrency_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume cboCurrency_NotInList_Exit
TIA
Alain