Hi,
I hope someone can help me. I've never done any public functions previously, but I have a short procedure which is going to be used in various part of the database so I'm hoping to put it into public function. However I am unable to call it (either the public function is wrong, or the way I call it is wrong).
This is what I have got so far:
Public Function modFormCompletionCheck(strValueEntered As Variant)
strValueEntered = Nz(Me.LocationID.Value, "")
If strValueEntered = "" Then
MsgBox "The location field should not be blank. Please re-enter.", _
vbExclamation, "Incomplete Form"
Exit Function
End If
End Function
--
Private Sub CreateRptUnderView_Click()
On Error GoTo Err_CreateRptUnderView_Click
Dim stDocName As String
Call Form_frmQuotesGenerator2.modFormCompletionCheck
'Create quote
stDocName = "Quotation 250"
DoCmd.OpenReport stDocName, acPreview
Exit_CreateRptUnderView_Click:
Exit Sub
Err_CreateRptUnderView_Click:
MsgBox Err.Description
Resume Exit_CreateRptUnderView_Click
End Sub
--
Can someone suggest what I have done wrong? The first part was the actual function. The second part was a procedure on a form trying to call that module. When I try to run it, it said there is a problem with this line:
Call Form_frmQuotesGenerator2.modFormCompletionCheck
Thanks in advance.
I hope someone can help me. I've never done any public functions previously, but I have a short procedure which is going to be used in various part of the database so I'm hoping to put it into public function. However I am unable to call it (either the public function is wrong, or the way I call it is wrong).
This is what I have got so far:
Public Function modFormCompletionCheck(strValueEntered As Variant)
strValueEntered = Nz(Me.LocationID.Value, "")
If strValueEntered = "" Then
MsgBox "The location field should not be blank. Please re-enter.", _
vbExclamation, "Incomplete Form"
Exit Function
End If
End Function
--
Private Sub CreateRptUnderView_Click()
On Error GoTo Err_CreateRptUnderView_Click
Dim stDocName As String
Call Form_frmQuotesGenerator2.modFormCompletionCheck
'Create quote
stDocName = "Quotation 250"
DoCmd.OpenReport stDocName, acPreview
Exit_CreateRptUnderView_Click:
Exit Sub
Err_CreateRptUnderView_Click:
MsgBox Err.Description
Resume Exit_CreateRptUnderView_Click
End Sub
--
Can someone suggest what I have done wrong? The first part was the actual function. The second part was a procedure on a form trying to call that module. When I try to run it, it said there is a problem with this line:
Call Form_frmQuotesGenerator2.modFormCompletionCheck
Thanks in advance.