Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Form With Filter Applied

Status
Not open for further replies.

Kiwiman

Technical User
May 6, 2005
88
GB
I have a form called frmReceiptReview, that has a command button cmdPaidInv - see code below. I would like this code to open the form "frmInvoiceByCustomer", and show only the invoices that have had cash applied. The cash applied is in the subform "child26" in the text box "ReceiptValue".

Currently the code opens the correct form, but returns no records.

I'm not sure if it is my code (i.e. the filter part) that is wrong - where I reference the ReceiptValue control on the subform or what.


Private Sub cmdPaidInv_Click()

Dim strDocName As String
Dim strFilter As String
Dim intVal As Integer

On Error GoTo Err_cmdPaidInv_Click

intVal = 0
strDocName = "frmInvoiceByCustomer"
strFilter = "[Forms]![frmInvoiceByCustomer].[Child26]![ReceiptValue] >" & intVal
'Forms!Orders![Orders Subform].Form.GetProductID


DoCmd.OpenForm strDocName, , , strFilter

Exit_cmdPaidInv_Click:
Exit Sub

Err_cmdPaidInv_Click:
MsgBox Err.Description
Resume Exit_cmdPaidInv_Click


End Sub

Confused half the time, going around in circles the other half. Any help would be appreciated
 
I think you should remove the quotes from the control reference, since you want to filter on the control's content. The code shown below will pass the control's current value.


strFilter = [Forms]![frmInvoiceByCustomer].[Child26]![ReceiptValue] & ">" & intVal


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top