Form error?

A

allie357

I keep getting this error: Compile error sub or function not defined. I
think it has to do with the addition of the option group but I don't
understand what is messing up...

Here is my code:
Code:
--------------------------------------------------------------------------------

Private Sub RunReport_Click()
Dim strRCName As String
Dim strDeptName As String
Dim strDate As String
Dim strWhere As String
Dim strDoc As String

' Build criteria string for RCName field
If IsNull(Me.CboRCName.Value) Then
strRCName = "Like '*'"
Else
strRCName = "='" & Me.CboRCName.Value & "'"
End If
' Build criteria string for DeptName field
If IsNull(Me.cboDeptName.Value) Then
strDeptName = "Like '*'"
Else
strDeptName = "='" & Me.cboDeptName.Value & "'"
End If

' Build criteria string for Doc field
SelectCase Me.FraDoc.Value
Case 1
strDoc = "='No Contract'"
Case 2
strDoc = "='No PO'"
Case 3
strDoc = "='No Contract and No PO'"
Case 4
strDoc = "Like '*'"
End Select

' Build the WHERE clause.
strDate = "[DateEntered] Between #" & Me!txtStartDate & _
"# And #" & Me!txtEndDate & "#"


'Strip off the leading " AND "
If Len(strWhere) > 0 Then
strWhere = Mid(strWhere, 6)
End If



' Combine criteria strings into a WHERE clause for the filter
strWhere = "[RCName] " & strRCName & " AND [DeptName] " &
strDeptName _
& " AND [MissingDocumentation] " & strDoc & " AND " & strDate

DoCmd.OpenReport "rpt_Violations_by_RC_x Violations", _
acViewPreview, , strWhere
End Sub
 
V

Vinayak N

Hi Allie,

Possible causes for this error are:

· You have misspelled the name of your procedure.
· The specified procedure is not visible to the calling procedure.
Procedures declared Private in one module can't be called from
procedures outside the module. If Option Private Module is in effect,
procedures in the module are not available to other projects. Choose
Find from the Edit menu to locate the procedure.
· You have declared a dynamic-link library (DLL) routine, but the
routine is not in the specified library.

(you may need to check the references in the VB-Code window)

Regards,
Vinayak.
 

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