Form --> report problem

  • Thread starter Thread starter Jill
  • Start date Start date
J

Jill

I have a button in a form that will ask for a keyword,
store it in strFilter and use it to generate a report,
the code as as following (grpField is a option group with
checkboxes ranging from 1 to 6)

------------------------------------
Private Sub CmdPreview_Click()
Dim strFilter As String
If Not IsNull(Me.txtWot2Find) Then
Select Case Me.grpField

Case 1
If IsNumeric(Me.txtWot2Find) Then
strFilter = "Project No = " & Me.txtWot2Find
Else
MsgBox "Invalid Project No."
End If
Case 2
strFilter = "Project Title Like ""*" &
Me.txtWot2Find & "*"""

Case 3
strFilter = "Company Like ""*" & Me.txtWot2Find
& "*"""

Case 4
strFilter = "Drawing Title Like ""*" &
Me.txtWot2Find & "*"""

Case 5
strFilter = "Revision Like ""*" & Me.txtWot2Find
& "*"""
Case 6
If IsNumeric(Me.txtWot2Find) Then
strFilter = "Box No = " & Me.txtWot2Find
Else
MsgBox "Invalid Box No."
End If


End Select

DoCmd.OpenReport "FR", acViewPreview, ,
strFilter
End If

End Sub

----------------------

when i enter the keyword and submit it, i get the
following error:
"438: object doenst support this property or method" ...
and it stops on the line "Select Case Me.grpField", are
there any errors? Any help would be appreciated! thanks

Jill
 
Jill,

Check to make sure the option group *really is* named
grpField. Open the form in design mode, click on the frame
around the option group and select properties. Click on
the "Other" tab. What does the Name line show?

Also, to keep from trying to open a report with no data,
you might add:

If Len(Trim(strFilter)) > 0 then
DoCmd.OpenReport "FR", acViewPreview, , strFilter
Else
MsgBox "Invalid keyword. Please try again"
Me.txtWot2Find = Null
Me.txtWot2Find.SetFocus
End If
 
Back
Top