ApplyFilter Problem

Jul 4, 2007

I have a form that prompts the user for a variable called PIDLookup and then applies a filter where the variable PID is equal to PIDLookup. For some reason when I run the following code I am asked to Enter Parameter Value for strWhere1. Why doesn't the program just take the user-inputted PIDLookup automatically? The code is as follows:

Dim strReport1 As String 'Name of report to open.
Dim strWhere1 As String

strReport1 = "All Visits"
strWhere1 = Me.PIDLookup

DoCmd.OpenReport strReport1, acViewPreview, ApplyFilter, "PID = strWhere1"

Thanks so much in advance.

View Replies


ADVERTISEMENT

Help With ApplyFilter On A Subform

Aug 24, 2005

:confused: I have a from with a combobox that is intended to filter a datasheet subform.

Private Sub CboFilterDate_AfterUpdate()
If [Forms]![Issues Selection and Reporting]![CboFilterDate] = "Today" Then
DoCmd.ApplyFilter , [Forms]![Issues Selection and Reporting]![Issues Selection Subform]![(Year([Opened Date]) = Year(Date) And Month([Due Date]) = Month(Date) And Day([Opened Date]) = Day(Date))]
End If
End Sub

My error reads that it can't frind the "Issues Selection Subform" mentioned in the expression.

Can anyone tell me where I messed up?

View 2 Replies View Related

Modules & VBA :: ApplyFilter With Boolean And String Data?

Nov 14, 2013

I have a form used to gather data around some supplier details, and we have a review check box with Boolean data. I'm trying to establish a filter button to filter un-checked boxes by specific suppliers from a drop-down list.

Although I've been able to run filters on suppliers and the review checks separately, together I get a "Type Mismatch" error. I thought it might be because of the Boolean data type, so I tried converting that to String but get the same issue.

So far what I've created is this:

Code:

Dim Chk1 As String
Chk1 = CStr([RevChk])
DoCmd.ApplyFilter , (" Chk1 = " & Chr(34) & 0 & Chr(34) & "") And (" [Supplier Name] = " & Chr(34) & txtSupplSearch & Chr(34) & "")

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved