Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

doCmd.TransferSpreadSheet query with parameters?

Posted on 2003-11-17
3
Medium Priority
?
1,701 Views
Last Modified: 2007-12-19
Hi I have a VB form that allows the user to choose the name of a company from a drop down list. I want to use the selected value of the drop downl list as an input to a access query. The results of this query I want to export to excel using the doCmd.TransferSpreadSheet command. DoCmd.TSS allows u to give it the name of a table or the name of a Select query, but how do I make sure my query's input parameter gets included.

my query looks like
  "Select * from Companies where ID=[x]"

I need to input the value of x into the query before I do the TSS, any ideas?

thanks
0
Comment
Question by:dav_evans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Accepted Solution

by:
Benjamin_Luk earned 250 total points
ID: 9769180
You query should be this:

"Select * from Companies where ID='"& Forms!MyFormName!Combo25 &"' "

revise myFormName as you real form name
and Combo25 as the name of your drop down list

Confirm you have open the form when you do the TSS, so you will not need input the value

Best Regards

Ben
0
 
LVL 9

Expert Comment

by:ornicar
ID: 10064201
----------------------------------------------------------------------------------------
This question has been abandoned and needs to be finalized.
 You can accept an answer, split the points, or get a refund (information at http:/help.jsp#hs5)
  If you need a moderator to help you, post a question at Community Support (http:/Community_Support/)

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ornicar
Cleanup Volunteer

---------------------------------------------------------------------------------------------
0
 
LVL 39

Expert Comment

by:stevbe
ID: 10103572
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: Benjamin_Luk {http:#9769180}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

stevbe
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question