Subform Query based on Unbound Txt n check boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I know there have been posts on subform queiries but i have spent the last
couple of hours and can't find anything relevant...

My situation am working on an ADP...
I got an unbound form which has txtBlock and chkCut on it and they will be
the view/query criteria...
Then on that same unbound form, I got a subform based on a view/query in
datasheet view returning all my records and the Planting_Details table as
the unique table...
which has a 1:M relationship with the Harvest_Info table...
and I have this other subform in datasheet view on the same unbound form ...

What i want it to do stay on that same form, and enter the criteria above
and maybe click on a GO button that will requery the view and return results
onto the first subform on the unbound form...
then i need to link 1st and 2nd subforms to show related records...

Im not great at VBA so any assistance to get this working will be much
appreciated.

Thanks.
 
I am replying to myself now.... :-)
I got the two forms subfrm1 and subfrm2 sitting on the unbound main form to
synchronzise via Master and Child Links ... and that is fine now...

The scenario i have now is a text box (txtBlock) that will take an int type
value and a check box (chkCut) that will take a bit type value as subfrm2
source query/view criteria. I also have a button btnRun. They are all sitting
on that main unbound form.

What I want to do is basically enter the values into those two fields
(txtBlock and chkCut) and when I click the btn run, it should requery subfrm1
and show records accordingly...
How do I do that... I need help please..
 
I get this error message when I click on the btnRun with the following code
inserted into the OnClick property:
Runtime Error 30010, Can not apply filter on one or more fields specified in
the filter Property.

Here is the code I put in:

Private Sub btnRun_Click()
Dim strSearch1 As String
Dim strSearch2 As String


strSearch1 = "Like '*' & txtBlock.Value & '*'"
strSearch2 = "Like '*' & chkCut.Value & '*'"


frmPlanting_Harvest.Form.Filter = "[Block] " & strSearch1 _
& " And [Cut] " & strSearch2
frmPlanting_Harvest.Form.FilterOn = True

End Sub
 
Back
Top