specifing fields to export

G

Guest

I'd like to specify which fields I'd like to export to excel (for mail merge)
using check boxes in a form.
I.E when check box for surname is ticked, surname is exported. If not
selected the surname field is hidden.

Any help please
 
J

Jeff Boyce

What you describe sounds very much like the query design window. Are you
looking to reinvent a way to select certain fields from one/more tables?

Regards

Jeff Boyce
<Access MVP>
 
M

Michel Walsh

Hi,


Write the string of the query, dynamically, with some VBA code, such as:


str="SELECT " & iif( check1, "field1,", null) & iif( check2,
"field2,", null) & ... "

' remove the ending coma,
mid(str, len(str), 1) = " "

'complete the statement
str=str & " FROM myTable"



Additionnal verification should be done, such as to be sure at least one
field is "checked", etc.



Hoping it may help,
Vanderghast, Access MVP
 

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