gold007eye
Registered User.
- Local time
- Yesterday, 22:27
- Joined
- May 11, 2005
- Messages
- 260
Can someone please help me figure this out.. Can't for the life of me get this to do what I want.
What I am trying to accomplish is that if a "Transaction Description" is Like "Gas*" Then allow that to be used without getting a "NotInList" error message, but if it is anything <> Gas* and isn't on the list to bring up the msgbox asking the user if they would like to add it to the system now.
Example 1:
If you type "Gas (Exxon) $2.64" into the "Transaction Description" combo box; just continue to the next field as normal. (Don't display NotInList Error Msg)
Example 2:
If you type "Stop & Shop (Groceries)" into the "Transaction Description" combo box; then pop-up a msgbox stating that this Transaction Type isn't on the list "Would you like to add it now?"
------------------------------------------
The code I am trying to use is listed below. The part I can't get to work is for the code to allow anything typed into the "Transaction Description" combo box that are LIKE "Gas*" without triggering an error.
What I am trying to accomplish is that if a "Transaction Description" is Like "Gas*" Then allow that to be used without getting a "NotInList" error message, but if it is anything <> Gas* and isn't on the list to bring up the msgbox asking the user if they would like to add it to the system now.
Example 1:
If you type "Gas (Exxon) $2.64" into the "Transaction Description" combo box; just continue to the next field as normal. (Don't display NotInList Error Msg)
Example 2:
If you type "Stop & Shop (Groceries)" into the "Transaction Description" combo box; then pop-up a msgbox stating that this Transaction Type isn't on the list "Would you like to add it now?"
------------------------------------------
The code I am trying to use is listed below. The part I can't get to work is for the code to allow anything typed into the "Transaction Description" combo box that are LIKE "Gas*" without triggering an error.
Code:
Private Sub Transaction_Description_NotInList(NewData As String, Response As Integer)
'-- This Transaction Type is not currently in the System (and is not a GAS type transaction), Let's add it now.
If [Transaction Description] Like "Gas*" Then
'Display No Error Message Allow this information to be stored
Response = acDataErrContinue
Else:
Select Case MsgBox("The Transaction Description " & NewData & " is NOT currently in the system" & vbCrLf & vbCrLf & "Would you like to add it now?", vbQuestion + vbYesNo, "Add New Transaction Information?")
Case vbYes: 'Add New Transaction Type
DoCmd.OpenForm "Modify Transaction Information", , , , acFormAdd, acDialog, NewData
MsgBox "Your new Transaction Description has been added to the system.", vbInformation, "New Transaction Information Added"
Response = acDataErrAdded
'Response = acDataErrContinue
Case vbNo: 'Do NOT Add New Transaction Type
MsgBox "You have selected an invalid Transaction Description" & vbCrLf & vbCrLf & "Please select an Transaction Description from the list...", vbExclamation, "Invalid Transaction Description..."
[Transaction Description] = Null
Response = acDataErrContinue
End Select
End If
End Sub