Calling a Function

S

shanesullaway

I am using the function NIL below in several cboBoxes and I am calling it in
the Forms module using: Response = NIL(NewData). My question is, can I call
the function NIL from the Properties window instead of the Form module and if
so how would I enter it?

TIA,
Shane


Function NIL(NewData As String) As Integer

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim stControlName As String
Dim stLabelName As String
stControlName = Screen.ActiveControl.Name
stLabelName = Me.txtLabelName

If Eval("Msgbox('The " & stLabelName & " ''" & NewData & "'', Is Not On
The " & stLabelName & " List!@Would you like me to " & _
"add ''" & NewData & "'' to the current " & stLabelName &
" List?" & _
"@@',4,'AMC Database System Error Message')") = vbNo Then
Me.cboChair.Undo
NIL = acDataErrContinue
Exit Function
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Component", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!Component = NewData
rs!DiscrpID = Me.txtDiscripID
rs.Update

If Err Then
MsgBox "An error occurred. Please try again."
NIL = acDataErrContinue
Else
NIL = acDataErrAdded
rs.Close
Set rs = Nothing
Set db = Nothing
End If

End If

End Function
 
S

shanesullaway via AccessMonster.com

Just bumping this past all the advertising post that we just added.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top