Solved

doCmd.TransferSpreadSheet query with parameters?

Posted on 2003-11-17
3
1,469 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
3 Comments
 
LVL 8

Accepted Solution

by:
Benjamin_Luk earned 125 total points
Comment Utility
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
Comment Utility
----------------------------------------------------------------------------------------
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now