Hi again
I have two forms that display different data fields from the same table. One form displays the data that users most commonly want to view and query. The secondary form contains more detailed data that is of occasional interest to the users. The second form is opened via a command button on the main form.
The users now want to be able to include fields from the secondary form in their queries of the main form.
I am having considerable difficulty linking the two forms to create a single query of the Recordset. I have tried passing the form filter created by the Query by Form to the second form using code as per below:
etc etc but keep getting errors. I have also put the MainFilter string into the DoCmd open argument, which produces the same problems. Although the selected field criteria/values are parsed to the secondary form filter and looks fine when viewed under Records/Advanced Filter, The QBF process seems to create double brackets around the filter data which is not recognised as valid field names by the second form. And as soon as the QBF function is activated on the second form it loses the filter that existed previously.
Both forms are heavily populated with data fields (over 80 in total) and the option of trying to stitch SQL around every field seems to be a cumbersome way of creating a singular query function for the users. Any of the data fields may be required to construct a query, although commonly only 5 - 10 fields are selected in any one query.
Can anyone point me to a solution that will allow the users to continue to use the QBF function - or not if anything else will work?
![[2thumbsup] [2thumbsup] [2thumbsup]](/data/assets/smilies/2thumbsup.gif)
I have two forms that display different data fields from the same table. One form displays the data that users most commonly want to view and query. The secondary form contains more detailed data that is of occasional interest to the users. The second form is opened via a command button on the main form.
The users now want to be able to include fields from the secondary form in their queries of the main form.
I am having considerable difficulty linking the two forms to create a single query of the Recordset. I have tried passing the form filter created by the Query by Form to the second form using code as per below:
Code:
Sub CommandOpenFormTwoButt_Click()
Dim MainFilter As String
MainFilter = Me.Filter
DoCmd.OpenForm "SecondayForm"
SecondaryForm.Filter = MainFilter
Both forms are heavily populated with data fields (over 80 in total) and the option of trying to stitch SQL around every field seems to be a cumbersome way of creating a singular query function for the users. Any of the data fields may be required to construct a query, although commonly only 5 - 10 fields are selected in any one query.
Can anyone point me to a solution that will allow the users to continue to use the QBF function - or not if anything else will work?
![[2thumbsup] [2thumbsup] [2thumbsup]](/data/assets/smilies/2thumbsup.gif)