D
Doug
I would like to be able to add new entries to a cbo
(ASECContact) and I have used the statement below. I have
used this same statement on other databases and it works
fine. But this time Access is not liking the DIM
statement? Any advice appreciated
thanks
Private Sub Combo137_NotInList(NewData As String,
Response As Integer)
Dim db As Database
Set db = CurrentDb
'Ask the user if they want to add to the list
If MsgBox("Do you want to add this entity to the list?",
vbYesNo + vbQuestion, "Add new value?") = vbYes Then
'The user clicked Yes - add the new value
db.Execute "INSERT INTO tblASECContact (ASECContact)
VALUES (""" & NewData & """)", dbFailOnError
'Tell Access you've added the new value
Response = acDataErrAdded
Else
'The user clicked No - discard the new value
Me.Combo137.Undo
'Tell Access you've discarded the new value
Response = acDataErrContinue
End If
db.Close
Set db = Nothing
End Sub
(ASECContact) and I have used the statement below. I have
used this same statement on other databases and it works
fine. But this time Access is not liking the DIM
statement? Any advice appreciated
thanks
Private Sub Combo137_NotInList(NewData As String,
Response As Integer)
Dim db As Database
Set db = CurrentDb
'Ask the user if they want to add to the list
If MsgBox("Do you want to add this entity to the list?",
vbYesNo + vbQuestion, "Add new value?") = vbYes Then
'The user clicked Yes - add the new value
db.Execute "INSERT INTO tblASECContact (ASECContact)
VALUES (""" & NewData & """)", dbFailOnError
'Tell Access you've added the new value
Response = acDataErrAdded
Else
'The user clicked No - discard the new value
Me.Combo137.Undo
'Tell Access you've discarded the new value
Response = acDataErrContinue
End If
db.Close
Set db = Nothing
End Sub