zubin6220
asked on
Add Not In List data
The following works fine except that the EventTypeTable has an additional field of >EventDescription< which of course will not populate. Since I am adding new data to this table, what needs to be done to include the EventDescription? how can this be entered? Thanks
Private Sub cboEventType_NotInList(New Data As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Book Category...")
If i = vbYes Then
strSQL = "Insert Into EventTypeTable ([EventType]) values ('" & NewData & "')"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
Private Sub cboEventType_NotInList(New
Dim strSQL As String
Dim i As Integer
Dim Msg As String
'Exit this sub if the combo box is cleared
If NewData = "" Then Exit Sub
Msg = "'" & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Do you want to add it?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Book Category...")
If i = vbYes Then
strSQL = "Insert Into EventTypeTable ([EventType]) values ('" & NewData & "')"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I apologize - mbizup just posted what i did - I agree with that answer
No problem, Raynard. I forgot to hit the refresh button before posting a comment tonight, myself.
btw -- welcome aboard :-)
btw -- welcome aboard :-)
ASKER
Thanks for the quick response. Works great!
Glad I could help :-)
strSQL = "Insert Into EventTypeTable ([EventType], [EventDescription]) values ('" & NewData & "', '" & StringWithDescription & "')"
Which would add both event type and event description.