Creating a query on the fly...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
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
 
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"
 
Back
Top