Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I pass a string to a query

Status
Not open for further replies.

ronh42

Programmer
Nov 20, 2002
10
US
I fairly new to this. However here goes. What I'm trying to do is pass a string to a query. Let's say to point to the correct table for the query to use to update another table. Then execute the query. Is this possible?
 
Ron,

It actually sounds like you may have your tables set up in a problematic way. Most likely, you have a few tables that should be combined into one, with a field added to differentiate between the different groups of data. Then you would only need to use a parameter in the where clause for a single field, which would be much easier.

You can't do what you're looking to do in a query, but you can do it in code.

Why don't you tell us a bit about your tables and what you're trying to do and the sql statement of the query you've got, and we'll be able to give you a lot more specific infomration.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
I can correct the table issue. But then I'm going to have to pass a number of strings for filters so the query does what I want.

Anyway my tables will consist of company, state, msa, serv, tract, year as my filter and grouping fields. The rest of the fields will be summed, etc.

My query will look like this.
Select company, state or msa, tract, sum(fld1), sum(fld2)
from mytable
where company = 'abc' and
state = 'MD' and
year = '1996'
group by company, state

I don't need year in the report. But I could add it.

The filter/grouping fields will be selected from a form. Hit the submit button and off you go.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top