PhilipEwen
Registered User.
- Local time
- Today, 17:07
- Joined
- Jun 11, 2001
- Messages
- 81
Hi,
I am currently generating a dynamic query based on form selections. The query then opens a form showing results. The user then gets the choice to export to Excel ( using macro ). A dynamic query is generated "dynam_qry" and used to show results and later export to excel.
The problem is that now we need to have multiple users. I am afraid that a dynamic query would be created, and before the person hits 'export to excel', another user has generated a query overwriting the old query ( same name ). Therfore if user 1 then hits 'export' the new query will have oversaved the previous one and they will export the wrong data.
One way i have thought ( probably wrong ! ) is to generate a random number to append to name of query, thus generating 'random' query. Call the dynamic query "query_23732489238" for example. Then delete the query upon export.
Don't know if this is the best way though - advice appreciated !
Perhaps a better way would be to use VBA to query by the same variable, store the variable and if export was chosen then use the variable again - as against creating query, storing query as a variable in memory until export is chosen, then using variable to query and then export.
Is this possible or a good way of doing it ?
If so - any ideas of how to do it would be great.
I am quite a newbie to VBA so links / guidance would be greatly appreciated.
Many thanks in advance
Phil.
I am currently generating a dynamic query based on form selections. The query then opens a form showing results. The user then gets the choice to export to Excel ( using macro ). A dynamic query is generated "dynam_qry" and used to show results and later export to excel.
The problem is that now we need to have multiple users. I am afraid that a dynamic query would be created, and before the person hits 'export to excel', another user has generated a query overwriting the old query ( same name ). Therfore if user 1 then hits 'export' the new query will have oversaved the previous one and they will export the wrong data.
One way i have thought ( probably wrong ! ) is to generate a random number to append to name of query, thus generating 'random' query. Call the dynamic query "query_23732489238" for example. Then delete the query upon export.
Don't know if this is the best way though - advice appreciated !
Perhaps a better way would be to use VBA to query by the same variable, store the variable and if export was chosen then use the variable again - as against creating query, storing query as a variable in memory until export is chosen, then using variable to query and then export.
Is this possible or a good way of doing it ?
If so - any ideas of how to do it would be great.
I am quite a newbie to VBA so links / guidance would be greatly appreciated.
Many thanks in advance
Phil.
Last edited: