Solved

doCmd.TransferSpreadSheet query with parameters?

Posted on 2003-11-17
3
1,518 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
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

809 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