I'm making a simple code to open a detail report using a clicked text box as a filter. First part works fine, activated on click from the [Fee Description] text box in the header:
I'm trying to expand this to include a subset as additional filter ([Fee Descriptoin] and [TAPSIZE]):
If I sub in a Fee Description directly into Filter1, the report opens just fine. It just keeps hanging up on me.[Fee Description] with run-time error 2465 - "Microsoft Office Access can't find the field 'Fee Description' referred to in your expression." Spelling is correct, copied identically from the working code above. What am I missing to be able to reference this field?
-Tyler
Code:
Private Sub Description_Click()
Dim Filter As String
Filter = Me.[Fee Description]
DoCmd.OpenReport "Tap and Hydrant Install Cost Detail", acViewPreview, , "[Fee Description] = '" & Filter & "'"
End Sub
I'm trying to expand this to include a subset as additional filter ([Fee Descriptoin] and [TAPSIZE]):
Code:
Private Sub TapSize_Click()
Dim Filter1 As String
Dim Filter2 As String
Filter2 = Me.TAPSIZE
Filter1 = Me.[Fee Description]
DoCmd.OpenReport "Tap and Hydrant Install Cost Detail", acViewPreview, , "[Fee Description] = '" & Filter1 & "' And [TAPSIZE] = '" & Filter2 & "'"
End Sub
If I sub in a Fee Description directly into Filter1, the report opens just fine. It just keeps hanging up on me.[Fee Description] with run-time error 2465 - "Microsoft Office Access can't find the field 'Fee Description' referred to in your expression." Spelling is correct, copied identically from the working code above. What am I missing to be able to reference this field?
-Tyler