S
SFC Traver
I'm having problem with the event procedure to add new values to a combo list
in a form. The form is tied to table (Data) and the combo list gets it's data
from another table (Diagnosis). Relationships are set between the two tables.
I've done the below and can't get it to work. What am i doing wrong???
Private Sub Admitting_Diagnosis_NotInList(NewData As String, Response As
Integer)
Dim db As Database
Set db = CurrentDb
If MsgBox("Do you want to add this value to the list?",
vbYesNo+vbQuestion,"Add new value?") = vbYes Then
db.Execute "INSERT INTO tbl.Diagnosis (Field1) VALUES (""" & NewData &
""")", dbFailOnError
Response = acDataErrAdded
Else
Me.Admitting_Diagnosis.Undo
Response = acDataErrContinue
End If
db.Close
Set db = Nothing
End Sub
Thanks
in a form. The form is tied to table (Data) and the combo list gets it's data
from another table (Diagnosis). Relationships are set between the two tables.
I've done the below and can't get it to work. What am i doing wrong???
Private Sub Admitting_Diagnosis_NotInList(NewData As String, Response As
Integer)
Dim db As Database
Set db = CurrentDb
If MsgBox("Do you want to add this value to the list?",
vbYesNo+vbQuestion,"Add new value?") = vbYes Then
db.Execute "INSERT INTO tbl.Diagnosis (Field1) VALUES (""" & NewData &
""")", dbFailOnError
Response = acDataErrAdded
Else
Me.Admitting_Diagnosis.Undo
Response = acDataErrContinue
End If
db.Close
Set db = Nothing
End Sub
Thanks