B
bymarce
I have the following sub on a form and I want to convert it to a function so
I can call it from several forms. When I try to do this, it opens the form
but doesn't fill in the value that was not in list. I've tried to move the
NewData and Response declarations down in to the sub but that doesn't work.
Thanks.
Marcie
Private Sub Property_NotInList(NewData As String, Response As Integer)
Dim strSQL As String, x As Integer
x = MsgBox("Do you want to add this Property to the list?", vbYesNo)
If x = vbYes Then
strSQL = "Insert Into Properties ([Property]) values ('" & NewData &
"')"
CurrentDb.Execute strSQL, dbFailOnError
DoCmd.OpenForm "Properties", acNormal, , "[Property]='" & NewData &
"'", acFormEdit, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
I can call it from several forms. When I try to do this, it opens the form
but doesn't fill in the value that was not in list. I've tried to move the
NewData and Response declarations down in to the sub but that doesn't work.
Thanks.
Marcie
Private Sub Property_NotInList(NewData As String, Response As Integer)
Dim strSQL As String, x As Integer
x = MsgBox("Do you want to add this Property to the list?", vbYesNo)
If x = vbYes Then
strSQL = "Insert Into Properties ([Property]) values ('" & NewData &
"')"
CurrentDb.Execute strSQL, dbFailOnError
DoCmd.OpenForm "Properties", acNormal, , "[Property]='" & NewData &
"'", acFormEdit, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub