Filter on subform not working

thescottsman

Registered User.
Local time
Today, 21:04
Joined
Sep 18, 2014
Messages
42
Hi All

I hope you can help

I have a navigation form which has two subforms on it (ie 2 tabs linking to different forms). I have got aq filter working for one of the forms but not on the other. This is using

If IsNull(Me.txtoperationscontract) Then
MsgBox "Please type a contract number into the textbox!", vbInformation + vbOKOnly, "Incorrect Details"
Else
Me.OperationsSubform.Form.Filter = "[Contract]='" & Me.txtoperationscontract.Value & "' "
Me.OperationsSubform.Form.FilterOn = True
End If

The problem is that it does not work on subform B because the Contract field does not exist.

How can I sort this problem out?
 
..

The problem is that it does not work on subform B because the Contract field does not exist.

How can I sort this problem out?
Set up the filter using a field you've in recordset for subform B.
 
Thanks for your reply

SubformA and subformB have no common fields. so how can I set a filter for the recordset?
 
Okay, what data do you want subform A, subform B and the main form should show? Show some sample data and how you want them shown!
 
Hi I think I have attached the pictures correctly.

The first picture shows SubformA. This is to be filtered using the fropdown menu.

The second print screen shows SubformB which is to be filtered using the textbox.

SubformA will update the table, as does SubformB. I have put the relvant code in the search buttons, but when I search on the wrong subform (for example search quotes on assign contract) it comes up with please enter a parameter. The problem is the Subform does not have this field. Basically The simplest solution I think is to set that parameter value ="", but cannot come up with a way of doing it

Thanks for your help again I hpe this helps a ltle
 

Attachments

  • PrintScreen1.jpg
    PrintScreen1.jpg
    91.5 KB · Views: 267
  • PrintScreen2.jpg
    PrintScreen2.jpg
    90 KB · Views: 209
Sorry - I can't see anything out of the pictures, (you know your data, I don't) .
Post your database with some sample data, zip it.
Edit:
Have you link the subform A and subform B to the main form using the "Link Master Fields" and "Link Child Fields"
 
Last edited:
Hope this will help.

The code on the subforms some wont be applicable as I have had to remove some of the tables etc
 

Attachments

Users who are viewing this thread

Back
Top Bottom