Search Query through Form

  • Thread starter Thread starter JasonSelf
  • Start date Start date
J

JasonSelf

It has been awhile since I have done this, and even then I had help.
am fairly new to Access (as it is supposed to be used) and I am tryin
to make a search form. What I need to happen is for a setup to be mad
with a text input box and a control button...when the button is presse
it searches the subform for the phrase entered in the text box an
narrows down the subform querys results...if that makes any sense.
am not sure what syntax I need to use here, and what things need to ge
assignments, any help would be greatly appreciated.

Thank you,
Jason Sel
 
Hi,

In Access you can apply a filter to records shown in a form.

To apply a filter to a subform would involve code like:

Forms("frmMainFormName")("SubFormControlName").Form.Filter = _
"[Country] = '" & Me.txtTextBoxName & "'"

Forms("frmMainFormName")("SubFormControlName").Form..FilterOn = True

You will need to change the form, sub form control and text box names.

The field [Country] would need to be changed to the your field name.

To show records with a Country beginning with a letter use:

Forms("frmMainFormName")("SubFormControlName").Form.Filter = _
"[Country] Like '" & Me.txtTextBoxName & "*'"

To remove the filter and show all records:

Forms("frmMainFormName")("SubFormControlName").Form..FilterOn = False

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/
 
Back
Top