Solved

Access Query Issue-Not a vild alias name

Posted on 2013-01-17
11
571 Views
Last Modified: 2013-01-21
When i try to save this query it gives an error of not a valid alias name.  Here it is:

SELECT
 dbo_calls.checkbox06 as [OC_CAll],
 dbo_calls.unduplicated AS Unduplicated,
 dbo_contacts.entered AS [Enterd Date],
 dbo_contacts.sex As Gender,
 dbo_contacts.birthday AS [Birth Date],
 dbo_contacts.popup01 AS [Marital Status],
 dbo_contacts.popup02 AS [Living Situation],
 dbo_contacts.race,
 dbo_contacts.checkbox01 AS [Arab American],
 dbo_contacts.checkbox02 AS [Latino/Hispanic],
 dbo_contacts.popup06 AS [Primary Language],
 dbo_calls.popup04 AS [Referral Source],
 dbo_contacts.checkbox03 AS [Medicare A & B],
 dbo_contacts.checkbox04 AS [Medicare A Only],
 dbo_contacts.checkbox05 AS [Medicare B Only],
 dbo_contacts.checkbox07 AS [Medicare Part D],
 dbo_contacts.checkbox06 AS [Medicare C-Advantage],
 dbo_contacts.checkbox15 AS [Supplemental Medicare-Medigap],
 dbo_contacts.checkbox32 AS [Medicaid Full],
 dbo_contacts.checkbox10 AS [Medicaid-Spend Down],
 dbo_contacts.checkbox16 AS [Veterans],
 dbo_contacts.checkbox12 AS [Social Security Disability],
 dbo_contacts.checkbox13 AS [Private Health Insurance],
 dbo_contacts.checkbox14 AS [Private Health Insurance],
 dbo_contacts.checkbox17 AS [Workers Compensation],
 dbo_contacts.checkbox18 AS [None],
 dbo_contacts.text02 AS [Other Insurance],
 dbo_contacts.popup15 As [Veteran Status],
 dbo_calls.popup07 AS [Caregiver Status],
 dbo_contacts.volunteer_id AS [Assisting Contact],
 dbo_contacts.number AS [Specialist Assisting Contact],
 dbo_calls.popup03 AS [Trigger],
 dbo_calls.popup09 AS [Primary Helper (ph) Yes/No],
 dbo_calls.popup10 AS [Primary Helper Relationship To Person Needing Services],
 dbo_calls.popup06 AS [PH Lives With Person Needing Services],
 dbo_calls.text07 AS [Hours Of Informal Care And Active Monitoring],
 dbo_calls.popup08 AS [Lacks Memory Or Cognitive Skills For Daily Decision Making],
 dbo_calls.checkbox28 AS [Housework],
 dbo_calls.checkbox29 AS [Taking Medications],
 dbo_calls.checkbox30 AS [Managing Money],
 dbo_calls.checkbox31 As Shopping,
 dbo_calls.checkbox32 AS [Using Telephone],
 dbo_calls.checkbox33 AS Transportation,
 dbo_calls.checkbox23 AS Bathing,
 dbo_calls.checkbox24 AS Dressing,
 dbo_calls.checkbox25 AS [Incontinence Care],
 dbo_calls.checkbox26 AS Transferring,
 dbo_calls.checkbox27 As Ambulation,
 dbo_contacts.checkbox28 AS [Below $2000],
 dbo_contacts.checkbox30 AS [Greater Than $2000],
 dbo_contacts.checkbox11 AS [Below Poverty Less Than $930],
 dbo_contacts.checkbox24 AS [Above Pverty Up To $2094],
 dbo_contacts.checkbox25 AS [Guidelines Less Than $3300],
 dbo_contacts.checkbox26 AS [More Than $3300],
 dbo_contacts.popup03 AS [Residential Living Status At Time],
 dbo_calls.call_date AS [Date Status Set To OC/CLP OR CAse Opened],
 dbo_calls.date01 AS [Date Plan Developed/revised],
 dbo_calls.volunteer_id AS [Counselor Name],
 dbo_calls.popup13 As [Date Shared For Evaluation Purposes],
 dbo_calls.call_time,
 dbo_calls.followup_due_by AS [Follow Up Expected Date],
 dbo_calls.popup12 AS [Person Receiving OC Refuses All Follw-up],
 dbo_calls.checkbox16 AS [Skilled Nursing Care],
 dbo_calls.checkbox18 AS [Private Pay Services],
 dbo_calls.checkbox19 AS [Waiver],
 dbo_calls.checkbox20 AS [program],
 dbo_calls.checkbox21 AS [Adult Home Help],
 dbo_calls.checkbox22 AS [Veteran Services],
 dbo_calls.followup_assigned_to AS [Staff Member Making Follow Up]
FROM dbo_contacts INNER JOIN dbo_calls ON dbo_contacts.[contact_id] = dbo_calls.[call_id]
WHERE (((dbo_calls.checkbox06)=True) AND ((dbo_contacts.entered) Between [From Date] And [To

Date]));
0
Comment
Question by:aplona
  • 3
  • 2
  • 2
  • +3
11 Comments
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
For starters, it's not best practice to put spaces or any punctuation other than underscore as a table or column name, as it forces you to surround it in square brackets [ ] in SQL.

Everything else looks ok at first glance, as I don't see any Access reserved words being used.

> dbo_contacts.entered AS [Enterd Date],
Typo, probably should be [Entered Date]
0
 
LVL 3

Author Comment

by:aplona
Comment Utility
Still same error,  The only reason im using the AS and brackets is becasue thats how i want to come out on the spreadsheet when i export it.
0
 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
Some of the names have slash marks (like: [Date Status Set To OC/CLP OR CAse Opened]) and others have dollar signs.  My bet is that even though those characters are accepted, it's choking on them now....just a guess.
0
 
LVL 26

Expert Comment

by:jerryb30
Comment Utility
In design mode, is any particular field highlighted?

can you post an empty database?

See this as regards special characters:
http://support.microsoft.com/kb/826763
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
try eliminating suspected columns or
build your query using small number of fields, save then continue until you get the error
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 15

Expert Comment

by:David L. Hansen
Comment Utility
Do your last couple of lines actually look like this:

And [To

Date]));
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Just backing up the first two comments (no points wanted)

The easiest way to test that and to switch to good naming conventions (No special characters) is to start with a more manageable query with just a couple of fields,

rename them without the punctuation...
Test your query ...
Add a couple more fields without special characters in the Aliases...
test...
etc...
0
 
LVL 3

Accepted Solution

by:
aplona earned 250 total points
Comment Utility
I got it, To many characters in the alias.  Thanks though, appreciate the quick response.
0
 
LVL 3

Author Comment

by:aplona
Comment Utility
I've requested that this question be deleted for the following reason:

To many characters in alias
0
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
Recommend accept on the author's comment, and refund points.
0
 
LVL 61

Expert Comment

by:mbizup
Comment Utility
Agreed... that's good information for others in similar predicaments.

aplona,

Jim's 'objection' cancelled the deletion.  You can click the "Accept as Solution" button under your own comment (at http:#a38787909 )
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

763 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

8 Experts available now in Live!

Get 1:1 Help Now