Export Queries and Tables to Excel

  • Thread starter Thread starter Denver
  • Start date Start date
D

Denver

Hi,
I have 2 list box in a form
1st lisbox display all the table in my database.....
RowSource: SELECT [Name] FROM MSysObjects WHERE [Type]=1 AND [Name] NOT LIKE
"MSysACEs" AND [Name] Not Like "MSysObjects" AND [Name] Not Like
"MSysAccessXML" AND [Name] Not Like "MSysQueries" AND [Name] Not Like
"MSysAccessobjects" AND [Name] Not Like "MSysRelationships" AND [Name] Not
Like "~TMPCLP313741" AND [Name] Not Like "~TMPCLP651241" ORDER BY [Name];

2nd listbox displays all my Queries.......
RowSource: SELECT [Name] FROM MSysObjects WHERE [Type]=5 AND [Name] NOT LIKE
"~sq_*" ORDER BY [Name];

I have a cmdbutton(Comman213) that would export to excel...
i want that this button will export to excel from the selection i made
either from listbox 1 or 2, is this possible? i try from the examples but not
succeed, is anyone is kind to help me how would be my codes be look like
because i don't know how to start to write my codes..iam using access 2003

thanks
denver
 
Sorry bhicks11 i deleted it because I think i am not going to use it but i
have this code now
it works will for all my Queries...but i want also to do the same thing in
my List207(that displays all my tables) that when i made a selection from my
table listbox(list207) and click on cmdExport Excel it export to excel too.

I want to use one command button which cmdExport Excel...

Dim i As Integer

For i = 0 List209.Column - 1
If List209.Selected(i) Then
DoCmd.TransferSpreadsheet acExport, 8, List209.Column(0, i), _
"D:\Database\Export Folders\EXCEL\" & List209.Column(0, i) & ".xls",
True, ""

thanks

denver

bhicks11 via AccessMonster.com said:
What code have you used? What errors did you recieve?

Bonnie
http://www.dataplus-svc.com
Hi,
I have 2 list box in a form
1st lisbox display all the table in my database.....
RowSource: SELECT [Name] FROM MSysObjects WHERE [Type]=1 AND [Name] NOT LIKE
"MSysACEs" AND [Name] Not Like "MSysObjects" AND [Name] Not Like
"MSysAccessXML" AND [Name] Not Like "MSysQueries" AND [Name] Not Like
"MSysAccessobjects" AND [Name] Not Like "MSysRelationships" AND [Name] Not
Like "~TMPCLP313741" AND [Name] Not Like "~TMPCLP651241" ORDER BY [Name];

2nd listbox displays all my Queries.......
RowSource: SELECT [Name] FROM MSysObjects WHERE [Type]=5 AND [Name] NOT LIKE
"~sq_*" ORDER BY [Name];

I have a cmdbutton(Comman213) that would export to excel...
i want that this button will export to excel from the selection i made
either from listbox 1 or 2, is this possible? i try from the examples but not
succeed, is anyone is kind to help me how would be my codes be look like
because i don't know how to start to write my codes..iam using access 2003

thanks
denver
 
Back
Top