subform record loop in VBA

zozew

Registered User.
Local time
Today, 19:21
Joined
Nov 18, 2010
Messages
199
ok i know everybody here squinches at the mentioning of mailmerge so lets forget that :)

how do i extract values from a subform with the same master field value as the main form.

master and sub tables are linked with an idNumber, so there can by many records in the subForms table with the master tables idNumber

i just want to get all the values (rows) in one field in the subforms table that are displaying, for the master forms current record (current records idNumber)

Im thinking that i have to have some kind of if statment together with a SQL query.....

Sorry for double posting but i think my previous post was explained a bit to complicated....

thx
 
A simple recordset based on a query linking your tables should give you all the records you are looking for.
 
A simple recordset based on a query linking your tables should give you all the records you are looking for.

I've done a query returning all records with the right ID

I just want to do it at the same time i do the mailmerge to word

Just before i mailmerge i would like to concat the values in one field from all the records in the query and but them into a tempVar.

What im not so familiar with is the syntaxt.

So to put it in one sentence:

I would like to add the SQL code from the query in VBA so i can take the ID from the current record put it in the SQL code, then run the SQL, get the recordset and then loop through the recordset and then concat all the values from one field into a string...then ill put the string in one of my variables and do my mailmerge.

Any pointers to how or where i could get some help with the basic structur iin VBA for it...i am reading through some books but they are not catering to my needs exactly so im trial and erroring a lot....
 

Users who are viewing this thread

Back
Top Bottom