Using a query form in VBA

S

senseinobaka

Hello.
I'm new to Access and VBA. I have set up a table called "Customer Visits"
Then I have a query when ran will return every record in "Customer Visits".
My next step was to make a Parent/Child Form that would allow me to chose a
customer and then search my table using the query and the customer criteria.
That works great and I end up with child form that shows me all the matching
records.

My goal is to move those desired records to a Word Table. If I place a
button besides the record and run mt VBA code it will work well. But I need
to go down each record and push the command button. This is just asking for
oversights. Is there anyway I could use just 1 command button and loop thru
all the records on my form?

I appreciate your help.
 
M

Margaret Bartley

senseinobaka said:
Hello.
I'm new to Access and VBA. I have set up a table called "Customer Visits"
Then I have a query when ran will return every record in "Customer
Visits".
My next step was to make a Parent/Child Form that would allow me to chose
a
customer and then search my table using the query and the customer
criteria.
That works great and I end up with child form that shows me all the
matching
records.

My goal is to move those desired records to a Word Table. If I place a
button besides the record and run mt VBA code it will work well. But I
need
to go down each record and push the command button. This is just asking
for
oversights. Is there anyway I could use just 1 command button and loop
thru
all the records on my form?

If I understand your request properly, you want to export to Word the detail
records for a given customer?

The best way to do this is to put in a command button on your form that says
something like, "Export customer detail to Word", and put the code in the
command button to create a recordset that you export to Word.

Depending upon how complex the query is, you might want to either create a
parameterized query that stays in your database, and run it in code, passing
the parameter, or, if it's fairly simple, you can create the query in your
code, send it to Word, and then delete the query.
 

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