Christine Pearc
Christine
- Local time
- Today, 23:48
- Joined
- May 13, 2004
- Messages
- 111
I’m receiving the following error message in one of my modules/procedures “Compile error - Expected variable or procedure, not module."
Here’s the background and code:
The module CheckForNulls checks for null values in form fields. The code is in a module because it should be available to all forms “on the fly”. The module is called by Private Sub cmdSend_Click() event, where it says
Cancel = CheckForNulls(me.form).
Due to the error message, I tried changing this to the following, but still get the error
Dim X As Boolean
X = CheckForNulls(Me.Form)
Back on the form, if CheckForNulls = False (no incomplete records were found), then some other routines take place.
Could someone look at this to help pinpoint what is wrong?
Christine
Here’s the background and code:
The module CheckForNulls checks for null values in form fields. The code is in a module because it should be available to all forms “on the fly”. The module is called by Private Sub cmdSend_Click() event, where it says
Cancel = CheckForNulls(me.form).
Due to the error message, I tried changing this to the following, but still get the error
Dim X As Boolean
X = CheckForNulls(Me.Form)
Back on the form, if CheckForNulls = False (no incomplete records were found), then some other routines take place.
PHP:
Public Function CheckForNulls(frm as form) as boolean
Dim ctl As Control
Dim intMsgResponse As Integer
' Loop through all the controls on the form
For Each ctl In frm.Controls
' Check the tag property
If ctl.Tag = "RequiredField" Then
' Check this control has a value
If ctl = "" Or IsNull(ctl) Then
' No Value - Cancel the update event
CheckForNulls = True
'Exit loop when an incomplete required field is found
Exit For
End If
End If
Next
' Check to see if a required field was blank and inform the user
If CheckForNulls = True Then
MsgBox "Please fill in all required fields."
End If
End Function
Could someone look at this to help pinpoint what is wrong?
Christine