Microsoft Access QueryDef problem with numeric column anme

5 pts.
Tags:
Database programming
Microsoft Access
Microsoft Access forms
Microsoft Access queries
I have a form that creates a query on the fly. It works great, but has a problem with columns that have numeric names. The table is not mine so I can not change the columns. When I run the query the column name appears in the column. I tried to find anything wrong in the query and could not. IF I open the query in design mode and click on one of the numeric columns, the query starts to display properly. The table has columns for years from 1996 to the present. Each column should be a boolean but is set up an integers. Here is an example: select 1996 from tblx column 1996 row1 1996 row2 1996 once I open and touch the query it behaves properly. select 1996 from tblx column 1996 row1 0 row2 -1 If I do not open the query and run Object dependencies on the query it displays properly also

Answer Wiki

Thanks. We'll let you know when a new response is added.

Have you tried using an alias for the problematic columns ?

Something like:

<pre>select 1996 as something from tblx</pre>

You could also try prefixing the column with the table name, like this:

<pre>select tblx.1996 from tblx</pre>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Randym
    Try putting your column in [ ]. This tells access that it is a column in a table and not reserved expressions. Select [1996] from tblx
    1,740 pointsBadges:
    report
  • SbElectric
    Yes, pre-fixing with [ ] will ensure it is col name. I do not think numeric col name to be problem. Or you may try on the Design mode ... use Year:[1996] (to give a temporary col name Year)
    2,540 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following