Column names on VBA SQL Query

Posted on 2011-09-15
Last Modified: 2012-05-12
CurrentDb.Execute "SELECT INTER.OTCOMBO, INTER.DTCOMBO, INTER.TCOMBO, INTER.SERVICE, INTER.CLASS, INTER.MIN*0.65, INTER.LTL*0.65, INTER.[500]*0.65, INTER.[1M]*0.65, [INTER].[2M]*0.65, [INTER].[5M]*0.65, [INTER].[10M]*0.65, [INTER].[20M]*0.65 INTO Get65 FROM [INTER] WHERE INTER.TCOMBO=" & Chr(34) & termcombo & Chr(34) & " AND INTER.SERVICE=" & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34) & " ORDER BY INTER.CLASS", dbFailOnError

Open in new window


Thank you for looking into this!

I have the above query. The problem is that when outputting, the query is not naming the columns. I've done internet research and could not find anything about what I am looking for.

What I really want is, lets take this part


^ Thats a column multiplication within the query (I am multiplying the column * 0.65) But when outputting, the column name comes up as "EXPR005"

Anyway to put in column name before the calculation?

Any help is much appreciated!

Question by:Shanan212

Accepted Solution

BusyMama earned 350 total points
ID: 36545199
[INTER].[20M]*0.65 AS <your column name here>

LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 150 total points
ID: 36545211
Seems you would want this ... one example shown:

CurrentDb.Execute "SELECT INTER.OTCOMBO, INTER.DTCOMBO, INTER.TCOMBO, INTER.SERVICE, INTER.CLASS, INTER.MIN*0.65 AS MyCalc1, INTER.LTL*0.65, INTER.[500]*0.65, INTER.[1M]*0.65, [INTER].[2M]*0.65, [INTER].[5M]*0.65, [INTER].[10M]*0.65, [INTER].[20M]*0.65 INTO Get65 FROM [INTER] WHERE INTER.TCOMBO=" & Chr(34) & termcombo & Chr(34) & " AND INTER.SERVICE=" & Chr(34) & [Forms]![Point2Point]![servicecombo] & Chr(34) & " ORDER BY INTER.CLASS", dbFailOnError

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HasData 9 37
MS Access Calculation wont work 5 36
access 7 26
MS Access VBA Print PDF just Current Page 9 12
In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
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 how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now