Entering a Field Name for a Parameter

G

Guest

I have a query which I would like to replicate by chaning 1 field to another
multiple times. I would like to be able to enter the field name I want to use
as the parameter for the query. Is there a way to do this?

For instance:

If the query has a statement like
Select [FIELD1]/100 as percent;

I would like to be able to change FIELD1 to FIELD2 easily, perhaps in a
popup box.

Thanks!
 
T

tina

you can run code to change a query's SQL statement, as

Dim qry As DAO.QueryDef

Set qry = CurrentDb.QueryDefs("QueryName")
qry.SQL = "enter the *complete* SQL statement here " _
& "between the quotes"

hth
 
J

John W. Vinson

I have a query which I would like to replicate by chaning 1 field to another
multiple times. I would like to be able to enter the field name I want to use
as the parameter for the query. Is there a way to do this?

For instance:

If the query has a statement like
Select [FIELD1]/100 as percent;

I would like to be able to change FIELD1 to FIELD2 easily, perhaps in a
popup box.

Thanks!

The need to do this very strongly suggests that your table design is
"spreadsheetish", with multiple repeating fields each of which needs to be
converted to a percent. What's the actual structure of your table? Is it a
linked spreadsheet, or a spreadsheet in the guise of a Table, or am I just
being over-concerned about apparent non-normal structure?

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top