Creating a query on the fly...

B

Brad Pears

Could someone post some code that allows me to create a query on the fly??

The reason I want to do this is because I am creating a table on the fly and
during creation - from one time to the next it may contain different fields.
So, I need to be able to create a query - sorted by one field that will
alwyas be there but will need to add different fields to the query each time
and select those to be displayed.

Could someone post some code that shows how to create a dynamic query, set a
sort order and include/exclude fields from displaying? I am using Access
2000.

Thanks, Brad
 
R

Rick Brandt

Brad said:
Could someone post some code that allows me to create a query on the
fly??
The reason I want to do this is because I am creating a table on the
fly and during creation - from one time to the next it may contain
different fields. So, I need to be able to create a query - sorted by
one field that will alwyas be there but will need to add different
fields to the query each time and select those to be displayed.

Could someone post some code that shows how to create a dynamic
query, set a sort order and include/exclude fields from displaying? I
am using Access 2000.

Thanks, Brad

No need to really "create" the query each time. Just change its SQL
property...

CurrentDb.QueryDefs("QueryName").SQL = "New SELECT Statement"
 

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