How do I make the field name equal the criteria?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Example - I have dollar amounts in a table and I'm trying to make the field
name equal to the parameter value (ie <$30) in a make-table query. So in
this example the field name would be "<$30", is this possible?
 
Holly

Perhaps I'm reading too much into your description...

If you might have a "<$30" field, might you also have a "$30-$60" field, and
a "$61-$90" field, and ...

If this is the direction you are trying to head with your "make-table
query", reconsider. While that might be the way to handle your situation
(un-described, so hard to offer suggestions on) if you only had a
spreadsheet, doing it that way in Access will cause both you and Access a
lot more work.

Consider posting a description of the subject area and what you want to
accomplish, not, as you have, "how" you are trying to do something (i.e.,
make-table, fieldnames = ...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Example - I have dollar amounts in a table and I'm trying to make the field
name equal to the parameter value (ie <$30) in a make-table query. So in
this example the field name would be "<$30", is this possible?

Well... DON'T.

A table with a fieldname of "<$30" would be an incorrectly designed table from
the start.

If you're trying to generate a report, a Crosstab query would make a heck of a
lot more sense than a make-table query. Try putting a calculated field in your
query like

PriceRange: Switch([Price] < 30, "<$30", [Price] < 100, "$30-$100", [Price] <
250, "$100-250")

and use this field as the column header in your crosstab.

Not knowing what you're trying to accomplish, of course, makes this just a
WAG.

John W. Vinson [MVP]
 
Perhaps I was too general - sorry about that . . . Ok I have a make-table
query where I typed the question [please enter the $$ amount] in the criteria
so it'll be a prompt, right, then the person types in 50. So all the dollar
amounts equal 50 and I'm trying to figure out a way to put the dollar amount
they entered as the actual field name perhaps even adding to the field name
like "$50 Sales" or just "$50". Is this possible?

John W. Vinson said:
Example - I have dollar amounts in a table and I'm trying to make the field
name equal to the parameter value (ie <$30) in a make-table query. So in
this example the field name would be "<$30", is this possible?

Well... DON'T.

A table with a fieldname of "<$30" would be an incorrectly designed table from
the start.

If you're trying to generate a report, a Crosstab query would make a heck of a
lot more sense than a make-table query. Try putting a calculated field in your
query like

PriceRange: Switch([Price] < 30, "<$30", [Price] < 100, "$30-$100", [Price] <
250, "$100-250")

and use this field as the column header in your crosstab.

Not knowing what you're trying to accomplish, of course, makes this just a
WAG.

John W. Vinson [MVP]
 
Holly

Why? As in "why are you creating fields 'on the fly'" in response to values
entered by the user? Why do you believe you need these fields? What are
your intentions?<g> What will having them enable you to do?

Regards

Jeff Boyce
Microsoft Office/Access MVP

holly said:
Perhaps I was too general - sorry about that . . . Ok I have a make-table
query where I typed the question [please enter the $$ amount] in the
criteria
so it'll be a prompt, right, then the person types in 50. So all the
dollar
amounts equal 50 and I'm trying to figure out a way to put the dollar
amount
they entered as the actual field name perhaps even adding to the field
name
like "$50 Sales" or just "$50". Is this possible?

John W. Vinson said:
Example - I have dollar amounts in a table and I'm trying to make the
field
name equal to the parameter value (ie <$30) in a make-table query. So
in
this example the field name would be "<$30", is this possible?

Well... DON'T.

A table with a fieldname of "<$30" would be an incorrectly designed table
from
the start.

If you're trying to generate a report, a Crosstab query would make a heck
of a
lot more sense than a make-table query. Try putting a calculated field in
your
query like

PriceRange: Switch([Price] < 30, "<$30", [Price] < 100, "$30-$100",
[Price] <
250, "$100-250")

and use this field as the column header in your crosstab.

Not knowing what you're trying to accomplish, of course, makes this just
a
WAG.

John W. Vinson [MVP]
 
Perhaps I was too general - sorry about that . . . Ok I have a make-table
query where I typed the question [please enter the $$ amount] in the criteria
so it'll be a prompt, right, then the person types in 50. So all the dollar
amounts equal 50 and I'm trying to figure out a way to put the dollar amount
they entered as the actual field name perhaps even adding to the field name
like "$50 Sales" or just "$50". Is this possible?

Not using a parameter query, no; and it would *STILL* be a Very Bad Idea.

Storing data - a sale amount - in a fieldname is simply WRONG.

Could you step back a bit and describe what real-life problem you are
attempting to solve? What do you intend to do with this table that you're
making?

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

Back
Top