Solved

Column names on VBA SQL Query

Posted on 2011-09-15
2
193 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
2 Comments
 
LVL 7

Accepted Solution

by:
BusyMama earned 350 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 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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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