Solved

Column names on VBA SQL Query

Posted on 2011-09-15
2
189 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
Comment Utility
[INTER].[20M]*0.65 AS <your column name here>

0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 150 total points
Comment Utility
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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 …

772 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

11 Experts available now in Live!

Get 1:1 Help Now