Manipulate recordset from SQL select

G

Graham

Hope I can make this clear as recordsets are certainly not my strong point.

Table 1 stores name and address data and from it the requirement is to print
labels - but, it is not straight forward as the final label content will
depend on the content of various fields.

My approach is to interrogate the recordset and thereby create variables for
each line number and write those to Table2 (using SQL Insert Into), from
which the labels will be printed.

I was going to modify some existing code that writes records to a
spreadsheet and looks like

sSQL = SELECT Table1 WHERE Condition = true
Me.RecordSource = sSQL
Me.Recordset.MoveFirst
Do
DoCmd.TransferSpreadsheet ....
Me.Recordset.MoveNext
Loop Until Me.Recordset.EOF

I figured to replace "DoCmd.TransferSpreadsheet ...." with the interrogation
of the fields - only I don't know the syntax to access the field values. And
then have DoCmd.RunSQL INSERT INTO Table2 ......

Hope I haven't missed anything
 

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