Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old August 30th, 2004, 02:04 PM
greetInfo greetInfo is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 71 greetInfo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 30 sec
Reputation Power: 4
Docmd.Outputto Help

I am trying to output the result of a query to an excel worksheet. But I
want only the filtered data to go to the sheet. Records are filtered based
on the user input on a form. The command I am giving is as follows:

DoCmd.OutputTo acQuery, "Get_country_Info", "MicrosoftExcel(*.xls)", "C:\Documents and Settings\sagarwal\My Documents\Database\test.xls", True, ""

where "Get_Country_Info" is a predefined query.
It gives me the details of all the countries but I only want the countries which the user selects from the list box in the form

Is there a way I can write the query itself in the OutputTo command? I tried to substitute the query itself instead of passing the query object as follows:

DoCmd.OutputTo acQuery, "select country_name from country where country_name in ( " & tempcountry ")", "MicrosoftExcel(*.xls)", "C:\Documents and Settings\sagarwal\My Documents\Database\test.xls", True, ""

where tempcountry is a list of selected countries by the user. But it gives me an error saying
"database engine could not recognize the oblect 'select country_name from country where country = 'USA'' "

Any ideas??? Thanks in advance.

Reply With Quote
  #2  
Old September 5th, 2004, 06:37 PM
dd944 dd944 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 dd944 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
DoCmd.outputto Help

Check out this link. This is a solution to your problem but it does not use the Docmd.

http://www.microsoft-accesssolutions.co.uk/query_using_listbox.htm

John

Reply With Quote
  #3  
Old September 9th, 2004, 04:05 PM
greetInfo greetInfo is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 71 greetInfo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 30 sec
Reputation Power: 4
Thanks

Thanks a lot. That is exactly what I was looking for. Appreciate your help

Regards,
GreetInfo


Quote:
Originally Posted by dd944
Check out this link. This is a solution to your problem but it does not use the Docmd.

http://www.microsoft-accesssolutions.co.uk/query_using_listbox.htm

John

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Docmd.Outputto Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway