Re: Creating a query in code
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Fri, 7 Jul 2006 00:01:34 +0800
If Access complains about an unknown data type on this line:
Dim db As DAO.Database
you need to set your references.
Choose References on the Tools menu (in the code window), and check the box
beside:
Microsoft DAO 3.6.
More info about references:
http://allenbrowne.com/ser-38.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<paulquinlan100@xxxxxxxxxxx> wrote in message
news:1152201282.707831.199290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Im still having problems...
For some reason the procedure doesnt even seem to run when i use
dbEngine
I've also tried using: Dim db As DAO.Database and the procedure wont
run, however if i rem out this line the procedure runs (but obviously
still doesnt do what i want it to!).
Ive tested it by putting a message box as the first line of the
procedure, and the box will not appear if either of the above
statements are included anywhere in the procedure.
Thanks again for any ideas
Paul
Allen Browne wrote:
How about creating a query for this task, and then assigning its SQL
property for export?
Example: say you create a query named qry4Export.
Then your code will do this:
Dim strSql As String
strSql = "SELECT ...
dbEngine(0)(0).qry4Export.SQL = strSql
DoCmd.OutputTo ...
<paulquinlan100@xxxxxxxxxxx> wrote in message
news:1152196425.993992.122140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Im trying to programmatically create a query so that it can be exported
to excel using docmd.outputto. I can do this easily enough with a saved
query, but as the user has a variety of options so i dont want to have
to have to set up all the possible queries beforehand.
Should i be using QueryDef for this?? Ive tried and it appears as
though the code doesnt even run, it wont even let me break into the
procedure and any msgbox's put in dont appear.
Any ideas?
Thanks a lot for any help.
Paul
.
- References:
- Creating a query in code
- From: paulquinlan100
- Re: Creating a query in code
- From: Allen Browne
- Re: Creating a query in code
- From: paulquinlan100
- Creating a query in code
- Prev by Date: Re: Creating a query in code
- Next by Date: Re: Send an email directly through Exchange
- Previous by thread: Re: Creating a query in code
- Next by thread: Access 2002 Auto numbering key
- Index(es):
Relevant Pages
|