Write to a query

G

Guest

I have designed a form with 6 unbound combo boxes and I need these to write
to a query. When i go in the form, i want to select the relevant drop downs
and then update them into the query How do i go about this?

Many Thanks,
Matt
 
K

kingston via AccessMonster.com

Please clarify what you mean by "write to a query." A query pulls
information stored in a table, form, or other data source. From your post,
it sounds like you want to create or refresh a query based on your combo
boxes. To do this you need to reference the combo box controls in your query
criteria. So for example, your query may have a field Field1. In the
criteria below Field1, you'll need to reference the correct combo box as such:


[Forms]![MyForm]![ComboBox1]
or with wild cards:
Like "*" & [Forms]![MyForm]![ComboBox1] & "*"

Once you use this in your query construction, you can add an event after the
combo box is updated to refresh the query. I hope this is what you mean by
"write to a query".
 
G

Guest

yeah thats what I meant. I have never been very good at explaining it! My
apologies, i realise how daft it sounds.

How would i add this event? Would it be in afterupdate and what code would I
need?

Matt

kingston via AccessMonster.com said:
Please clarify what you mean by "write to a query." A query pulls
information stored in a table, form, or other data source. From your post,
it sounds like you want to create or refresh a query based on your combo
boxes. To do this you need to reference the combo box controls in your query
criteria. So for example, your query may have a field Field1. In the
criteria below Field1, you'll need to reference the correct combo box as such:


[Forms]![MyForm]![ComboBox1]
or with wild cards:
Like "*" & [Forms]![MyForm]![ComboBox1] & "*"

Once you use this in your query construction, you can add an event after the
combo box is updated to refresh the query. I hope this is what you mean by
"write to a query".

Matt said:
I have designed a form with 6 unbound combo boxes and I need these to write
to a query. When i go in the form, i want to select the relevant drop downs
and then update them into the query How do i go about this?

Many Thanks,
Matt
 
K

kingston via AccessMonster.com

Yes, add the code to each combo box's After Update event. If the query is a
subform, the code will look like this:

Me.Subform.Requery

If you just want to open the query:

Docmd.OpenQuery "QueryName"

Matt said:
yeah thats what I meant. I have never been very good at explaining it! My
apologies, i realise how daft it sounds.

How would i add this event? Would it be in afterupdate and what code would I
need?

Matt
Please clarify what you mean by "write to a query." A query pulls
information stored in a table, form, or other data source. From your post,
[quoted text clipped - 17 lines]
 

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

Top