Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Column names on VBA SQL Query

Posted on 2011-09-15
2
Medium Priority
?
201 Views
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


Hi,

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

[INTER].[20M]*0.65

^ 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!

Shanan
0
Comment
Question by:Shanan212
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

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

0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 600 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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

660 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