Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

# in Column Name - within Query

Posted on 2014-04-12
9
Medium Priority
?
450 Views
Last Modified: 2014-04-12
Hello All,

There are several joined tables and I created a query that joins them and pulls data with new column headers. One column (old name : NumOfP) gets renamed as [# of P] in that query.

When I try to extract that query into excel via right clicking, I see that the result excel file has the column name as [. of P] not [# of P] - why is that....and cant this be fixed so that the extract pulls the column names as desired
0
Comment
Question by:Rayne
  • 5
  • 4
9 Comments
 

Author Comment

by:Rayne
ID: 39996849
thank you
0
 

Author Comment

by:Rayne
ID: 39996850
also if i vba it so that the query results from access, gets dumped directly in a separate excel file - will the above issue still persists?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39996876
I don't know the exact answer to your question but you are doing two things that I would never do.  #1. putting symbols/punctuation in column names.  #2. putting spaces in column names.  In other databases like MySQL or Microsoft SQL Server, those would cause you problems.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39996879
'identifier' rules for Microsoft SQL Server http://technet.microsoft.com/en-us/library/ms175874.aspx  and for MySQL http://dev.mysql.com/doc/refman/5.6/en/identifiers.html  You might be able to use names that are not strictly alphanumeric and/or include spaces if you quote them.  Otherwise you are usually restricted to alphanumeric like [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) .
0
 

Author Comment

by:Rayne
ID: 39996890
Hello Dave,

I think you misunderstood. I am following all the proper naming conventions (no spaces, no # etc)  for column names within the actual table. So that's not an issue.


When my query pulls in the data, one of the fields from a table needs to have [# of P] as the extract column....do you get it?
0
 

Author Comment

by:Rayne
ID: 39996891
its for readibility for the end users
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39996893
But it's still a column name in your output results so it is an issue.  I don't think you can do that while you are still in Access (or any other database).  If you can extract the data with VBA, you can have VBA name the display whatever you want.
0
 

Author Comment

by:Rayne
ID: 39996904
Hmm, good call - totally forgot :(
Thank you Sire for your kindness
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39996948
You're welcome, glad to help.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
New style of hardware planning for Microsoft Exchange server.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

879 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