Creating a Query Form

G

Guest

I want to create a Form to query an equipment list. I have an Equipment Table
containing all the equipment records. I need to query the list by the
Equipment Manufacturer, Equipment Name, or Equipment Model. The form should
be able to allow searching for any part of the field, and not to match the
whole field.

For this, I have started with a Main form with three unbound fields
(Mfg,Name, and Model) for the search filter. Then I have a subform that in
Datasheet view will display the records for the three fields.

The trouble I am encountering is that I can't link the subform to the main
form. Is there is a way to do this?

Thanks in advance.
 
G

Guest

Hi Martin,

Use the after update or on change event for your text boxes, and then set a
filter for your subform like this:

me.SUBFORMNAME.form.filter = "[Mfg] like *" & me.Mfg & "*"
me.SUBFORMNAME.form.filteron = true

Remember to check for null values and ignore as necessary.

Hope this helps.

Damian.
 
G

Guest

MFG,is this the field for the Query in the subform or the field in the
unbound box in the Main form? I tried both but does not work.

Do I need to do anything to the Query in the subform?


Damian S said:
Hi Martin,

Use the after update or on change event for your text boxes, and then set a
filter for your subform like this:

me.SUBFORMNAME.form.filter = "[Mfg] like *" & me.Mfg & "*"
me.SUBFORMNAME.form.filteron = true

Remember to check for null values and ignore as necessary.

Hope this helps.

Damian.

Martin said:
I want to create a Form to query an equipment list. I have an Equipment Table
containing all the equipment records. I need to query the list by the
Equipment Manufacturer, Equipment Name, or Equipment Model. The form should
be able to allow searching for any part of the field, and not to match the
whole field.

For this, I have started with a Main form with three unbound fields
(Mfg,Name, and Model) for the search filter. Then I have a subform that in
Datasheet view will display the records for the three fields.

The trouble I am encountering is that I can't link the subform to the main
form. Is there is a way to do this?

Thanks in advance.
 
G

Guest

Thanks for your suggestions. I tried a different way, and this was by adding
in the criteria of the Query for the subform:

Like "*" & forms!myMainForm!UBFieldName & "*" or Forms!myMainForm!_
UBFieldName is null

In the UBFieldName AfterUpdate event I only inserted

mySubformName.Requery


Martin said:
MFG,is this the field for the Query in the subform or the field in the
unbound box in the Main form? I tried both but does not work.

Do I need to do anything to the Query in the subform?


Damian S said:
Hi Martin,

Use the after update or on change event for your text boxes, and then set a
filter for your subform like this:

me.SUBFORMNAME.form.filter = "[Mfg] like *" & me.Mfg & "*"
me.SUBFORMNAME.form.filteron = true

Remember to check for null values and ignore as necessary.

Hope this helps.

Damian.

Martin said:
I want to create a Form to query an equipment list. I have an Equipment Table
containing all the equipment records. I need to query the list by the
Equipment Manufacturer, Equipment Name, or Equipment Model. The form should
be able to allow searching for any part of the field, and not to match the
whole field.

For this, I have started with a Main form with three unbound fields
(Mfg,Name, and Model) for the search filter. Then I have a subform that in
Datasheet view will display the records for the three fields.

The trouble I am encountering is that I can't link the subform to the main
form. Is there is a way to do this?

Thanks in advance.
 
G

Guest

No worries... that will work also.

D.

Martin said:
Thanks for your suggestions. I tried a different way, and this was by adding
in the criteria of the Query for the subform:

Like "*" & forms!myMainForm!UBFieldName & "*" or Forms!myMainForm!_
UBFieldName is null

In the UBFieldName AfterUpdate event I only inserted

mySubformName.Requery


Martin said:
MFG,is this the field for the Query in the subform or the field in the
unbound box in the Main form? I tried both but does not work.

Do I need to do anything to the Query in the subform?


Damian S said:
Hi Martin,

Use the after update or on change event for your text boxes, and then set a
filter for your subform like this:

me.SUBFORMNAME.form.filter = "[Mfg] like *" & me.Mfg & "*"
me.SUBFORMNAME.form.filteron = true

Remember to check for null values and ignore as necessary.

Hope this helps.

Damian.

:

I want to create a Form to query an equipment list. I have an Equipment Table
containing all the equipment records. I need to query the list by the
Equipment Manufacturer, Equipment Name, or Equipment Model. The form should
be able to allow searching for any part of the field, and not to match the
whole field.

For this, I have started with a Main form with three unbound fields
(Mfg,Name, and Model) for the search filter. Then I have a subform that in
Datasheet view will display the records for the three fields.

The trouble I am encountering is that I can't link the subform to the main
form. Is there is a way to do this?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top