Share via

SQL Not a Valid Alias Name Error

Anonymous
2017-07-31T02:45:13+00:00

I have a query named: QryGrievanceTrackingForm it has the following SQL that I revised from a much longer SQL because I was getting an error: not a valid alias name.  I revised the original SQL to correct table names from: [Grievance Tracking System] to: tblGrievanceTrackingSystem and from: Members to tblMembers.  Before beginning to rename the 2 table in the original query, I got an: Inner Join error when I opened this query in design view.  I THINK I corrected the Inner Join error.  Now, I'm getting the error: not a valid alias name.  After clicking OK my insertion goes to the beginning of: tblGrievanceTrackingSystem.*,.

I've read so many different things about this error: use quotation marks; use brackets and; you cannot have a field name that's in table that's the same as the table name.

I'm using: tblGrievanceTrackingSystem.*, tblMembers.*, so I can get to query grid and attempt to correct the problems there and because I wanted to retain the time intervals I created.  I read: "When you want to include all the fields from a data source, you can either list all the fields individually in the SELECT clause, or you can use the asterisk wildcard character (*)."  Thanks for the help, Robert.

SELECT tblMembers.*, tblGrievanceTrackingSystem.*, DateAdd("d",14,[IncidentDate]) AS [Last Day To Discuss At Informal A], DateAdd("d",7,[DiscussedDate]) AS [Last Day To Appeal To Step A], DateAdd("d",7,[DateAppealedFormalStepA]) AS [Last Day For Step A Meeting], DateAdd("d",7,[FormalStepAMeetingDate]) AS [Last Day To Appeal To Step B], DateDiff("d",[PDIDate],[DisciplineDated]) AS [Time Interval-PDI Date/Date Discipline Dated], DateDiff("d",[PDIDate],[DateDisciplineReceived]) AS [Time Interval-PDI Date/Date Discipline Received], DateDiff("d",[PDIDate],[DiscussedDate]) AS [Time Interval-PDI Date/Date Discussed], DateDiff("d",[PDIDate],[DateResolvedInformalStepA]) AS [Time Interval-PDI Date/Date Resolved Informal Step A], DateDiff("d",[PDIDate],[DateAppealedFormalStepA]) AS [Time Interval-PDI Date/Date Appealed To Formal Step A], DateDiff("d",[PDIDate],[FormalStepAMeetingDate]) AS [Time Interval-PDI Date/Step A Meeting], DateDiff("d",[PDIDate],[StepADecisionDate]) AS [Time Interval-PDI Date/Step A Decision Date], DateDiff("d",[PDIDate],[DateResolvedformalStepA]) AS [Time Interval-PDI Date/Date Resolved Step A], DateDiff("d",[PDIDate],[StepBAppealDate]) AS [Time Interval-PDI Date/Step B Appeal Date], DateDiff("d",[PDIDate],[USPSTrackingDateDelivered]) AS [Time Interval-PDI Date/Date Step B Appeal Delivered to Step B Team], DateDiff("d",[PDIDate],[DateReceivedAtStepB]) AS [Time Interval-PDI Date/Date Step B Appeal Received], DateDiff("d",[PDIDate],[StepBDecisionDate]) AS [Time Interval-PDI Date/Date Step B Decision/Impasse], DateDiff("d",[PDIDate],[DateAppealedArbitration]) AS [Time Interval-PDI Date/Date Step B Impasse Appealed to Arbitration], DateDiff("d",[PDIDate],[DateRegionalArbitrationScheduled]) AS [Time Interval-PDI Date/Date Step B Impasse Regional Arb Scheduled], DateDiff("d",[PDIDate],[DatePreArbAgreement]) AS [Time Interval-PDI Date/Date Step B Impasse Pre-Arb Agreement], DateDiff("d",[PDIDate],[DateRegionalArbAward]) AS [Time Interval-PDI Date/Date Step B Impasse Regional Arb Award], DateDiff("d",[PDIDate],[DateAppealedNationalArbitration]) AS [Time Interval-PDI Date/Date Step B Impasse Appealed to National Arbitration], DateDiff("d",[PDIDate],[DateNationalArbitrationScheduled]) AS [Time Interval-PDI Date/Date Step B Impasse National Arbitration Scheduled], DateDiff("d",[PDIDate],[DateNationalArbAward]) AS [Time Interval-PDI Date/Date Step B Impasse National Arb Award], DateDiff("d",[IncidentDate],[DisciplineDated]) AS [Time Interval-IncidentDate/Date Discipline Dated], DateDiff("d",[IncidentDate],[DateDisciplineReceived]) AS [Time Interval-IncidentDate/Date Discipline Received], DateDiff("d",[IncidentDate],[DiscussedDate]) AS [Time Interval-IncidentDate/Date Discussed], DateDiff("d",[IncidentDate],[DateResolvedInformalStepA]) AS [Time Interval-IncidentDate/Date Resolved Informal Step A], DateDiff("d",[IncidentDate],[DateAppealedFormalStepA]) AS [Time Interval-IncidentDate/Date Appealed To Formal Step A], DateDiff("d",[IncidentDate],[FormalStepAMeetingDate]) AS [Time Interval-IncidentDate/Step A Meeting], DateDiff("d",[IncidentDate],[StepADecisionDate]) AS [Time Interval-IncidentDate/Step A Decision Date], DateDiff("d",[IncidentDate],[DateResolvedFormalStepA]) AS [Time Interval-IncidentDate/Date Resolved Step A], DateDiff("d",[IncidentDate],[StepBAppealDate]) AS [Time Interval-IncidentDate/Step B Appeal Date], DateDiff("d",[IncidentDate],[USPSTrackingDateDelivered]) AS [Time Interval-IncidentDate/Date Step B Appeal Delivered to Step B Team], DateDiff("d",[IncidentDate],[DateReceivedAtStepB]) AS [Time Interval-IncidentDate/Date Step B Appeal Received], DateDiff("d",[IncidentDate],[StepBDecisionDate]) AS [Time Interval-IncidentDate/Date Step B Decision/Impasse], DateDiff("d",[IncidentDate],[DateAppealedArbitration]) AS [Time Interval-IncidentDate/Date Step B Impasse Appealed to Regioal Arbitration], DateDiff("d",[IncidentDate],[DateRegionalArbitrationScheduled]) AS [Time Interval-IncidentDate/Date Step B Impasse Regional Arb Scheduled], DateDiff("d",[IncidentDate],[DatePreArbAgreement]) AS [Time Interval-IncidentDate/Date Step B Impasse Pre-Arb Agreement], DateDiff("d",[IncidentDate],[DateRegionalArbAward]) AS [Time Interval-IncidentDate/Date Step B Impasse Regional Arb Award], DateDiff("d",[IncidentDate],[DateAppealedNationalArbitration]) AS [Time Interval-IncidentDate/Date Step B Impasse Appealed to National Arbitration], DateDiff("d",[IncidentDate],[DateNationalArbitrationScheduled]) AS [Time Interval-IncidentDate/Date Step B Impasse National Arbitration Scheduled], DateDiff("d",[IncidentDate],[DateNationalArbAward]) AS [Time Interval-IncidentDate/Date Step B Impasse National Arb Award], DateDiff("d",[DiscussedDate],[DateAppealedFormalStepA]) AS [Time Interval-Date Discussed/Date Step A Appeal], DateDiff("d",[DiscussedDate],[FormalStepAMeetingDate]) AS [Time Interval-Date Discussed/Date Step A Meeting], DateDiff("d",[DiscussedDate],[StepADecisionDate]) AS [Time Interval-Date Discussed/Date Step A Decision], DateDiff("d",[DiscussedDate],[DateResolvedFormalStepA]) AS [Time Interval-Date Discussed/Date Resolved Step A], DateDiff("d",[DiscussedDate],[StepBAppealDate]) AS [Time Interval-Date Discussed/Date Step B Appeal], DateDiff("d",[DiscussedDate],[USPSTrackingDateDelivered]) AS [Time Interval-Date Discussed/Date Step B Appeal Delivered to Step B Team], DateDiff("d",[DiscussedDate],[DateReceivedAtStepB]) AS [Time Interval-Date Discussed/Date Step B Appeal Received], DateDiff("d",[DiscussedDate],[StepBDecisionDate]) AS [Time Interval-Date Discussed/Date Step B Decision/Impasse], DateDiff("d",[DiscussedDate],[DateAppealedArbitration]) AS [Time Interval-Date Discussed/Date Step B Impasse Appealed to Regional Arbitration], DateDiff("d",[DiscussedDate],[DateRegionalArbitrationScheduled]) AS [Time Interval-Date Discussed/Date Step B Impasse Regional Arb Scheduled], DateDiff("d",[DiscussedDate],[DatePreArbAgreement]) AS [Time Interval-Date Discussed/Date Step B Impasse Pre-Arb Agreement], DateDiff("d",[DiscussedDate],[DateRegionalArbAward]) AS [Time Interval-Date Discussed/Date Step B Impasse Regional Arb Award], DateDiff("d",[DiscussedDate],[DateAppealedNationalArbitration]) AS [Time Interval-Date Discussed/Date Step B Impasse Appealed to National Arbitration], DateDiff("d",[DiscussedDate],[DateNationalArbitrationScheduled]) AS [Time Interval-Date Discussed/Date Step B Impasse National Arbitration Scheduled], DateDiff("d",[DiscussedDate],[DateNationalArbAward]) AS [Time Interval-Date Discussed/Date Step B Impasse National Arbitration Award], DateDiff("d",[DateAppealedFormalStepA],[FormalStepAMeetingDate]) AS [Time Interval-Date Appealed Step A/Date Formal Step Meeting], DateDiff("d",[DateAppealedFormalStepA],[StepADecisionDate]) AS [Time Interval-Date Appealed Step A/Date Step A Decision], DateDiff("d",[DateAppealedFormalStepA],[DateResolvedFormalStepA]) AS [Time Interval-Date Appealed Step A/Date Resolved Step A], DateDiff("d",[DateAppealedFormalStepA],[StepBAppealDate]) AS [Time Interval-Date Appealed Step A/Date Step B Appeal], DateDiff("d",[DateAppealedFormalStepA],[USPSTrackingDateDelivered]) AS [Time Interval-Date Appealed Step A/Date Step B Appeal Delivered to Step B Team], DateDiff("d",[DateAppealedFormalStepA],[DateReceivedAtStepB]) AS [Time Interval-Date Appealed Step A/Date Step B Received Appeal], DateDiff("d",[DateAppealedFormalStepA],[StepBDecisionDate]) AS [Time Interval-Date Appealed Step A/Date Step B Decision/Impasse], DateDiff("d",[DateAppealedFormalStepA],[DateAppealedArbitration]) AS [Time Interval-Date Appealed Step A/Date Step B Impasse Appealed to Regional Arbitration], DateDiff("d",[DateAppealedFormalStepA],[DateRegionalArbitrationScheduled]) AS [Time Interval-Date Appealed Step A/Date Step B Impasse Regional Arb Scheduled], DateDiff("d",[DateAppealedFormalStepA],[DatePreArbAgreement]) AS [Time Interval-Date Appealed Step A/Date Step B Impasse Pre-Arb Agreement], DateDiff("d",[DateAppealedFormalStepA],[DateRegionalArbAward]) AS [Time Interval-Date Appealed Step A/Date Step B Impasse Regional Arb Award], DateDiff("d",[DateAppealedFormalStepA],[DateAppealedNationalArbitration]) AS [Time Interval-Date Appealed Step A/Date Step B Impasse Appealed to National Arbitration], DateDiff("d",[DateAppealedFormalStepA],[DateNationalArbitrationScheduled]) AS [Time Interval-Date Appealed Step A/Date Step B Impasse National Arbitration Scheduled], DateDiff("d",[DateAppealedFormalStepA],[DateNationalArbAward]) AS [Time Interval-Date Appealed Step A/Date National Arbitration Award], DateDiff("d",[FormalStepAMeetingDate],[StepADecisionDate]) AS [Time Interval-Date Step A Meeting/Date Step A Decision], DateDiff("d",[FormalStepAMeetingDate],[DateResolvedFormalStepA]) AS [Time Interval-Date Step A Meeting/Date Step A Resolved], DateDiff("d",[FormalStepAMeetingDate],[StepBAppealDate]) AS [Time Interval-Date Step A Meeting/Date Step B Appeal], DateDiff("d",[FormalStepAMeetingDate],[USPSTrackingDateDelivered]) AS [Time Interval-Date Step A Meeting/Date Step B Appeal Delivered to Step B Team], DateDiff("d",[FormalStepAMeetingDate],[DateReceivedAtStepB]) AS [Time Interval-Date Step A Meeting/Date Step B Appeal Received], DateDiff("d",[FormalStepAMeetingDate],[StepBDecisionDate]) AS [Time Interval-Date Step A Meeting/Date Step B Decision/Impasse], DateDiff("d",[FormalStepAMeetingDate],[DateAppealedArbitration]) AS [Time Interval-Date Step A Meeting/Date Step B Impasse Appealed to Regional Arbitration], DateDiff("d",[FormalStepAMeetingDate],[DateRegionalArbitrationScheduled]) AS [Time Interval-Date Step A Meeting/Date Regional Arbitration Scheduled], DateDiff("d",[FormalStepAMeetingDate],[DatePreArbAgreement]) AS [Time Interval-Date Step A Meeting/Date Step B Impasse Pre-Arb Agreement], DateDiff("d",[FormalStepAMeetingDate],[DateRegionalArbAward]) AS [Time Interval-Date Step A Meeting/Date Step B Impasse Regional Arb Award], DateDiff("d",[FormalStepAMeetingDate],[DateAppealedNationalArbitration]) AS [Time Interval-Date Step A Meeting/Date Step B Impasse Appealed to National Arbitration], DateDiff("d",[FormalStepAMeetingDate],[DateNationalArbitrationScheduled]) AS [Time Interval-Date Step A Meeting/Date Step B Impasse National Arbitration Scheduled], DateDiff("d",[FormalStepAMeetingDate],[DateNationalArbAward]) AS [Time Interval-Date Step A Meeting/Date National Arbitration Award], DateDiff("d",[StepBAppealDate],[USPSTrackingDateDelivered]) AS [Time Interval-Date Step B Appeal/Date Step B Appeal Delivered to Step B Team], DateDiff("d",[StepBAppealDate],[DateReceivedAtStepB]) AS [Time Interval-Date Step B Appeal/Date Step B Received Date], DateDiff("d",[StepBAppealDate],[StepBDecisionDate]) AS [Time Interval-Date Step B Appeal/Date Step B Decision/Impasse], DateDiff("d",[StepBAppealDate],[DateAppealedArbitration]) AS [Time Interval-Date Step B Appeal/Date Step B Impasse Appealed to Regional Arbitration], DateDiff("d",[StepBAppealDate],[DateRegionalArbitrationScheduled]) AS [Time Interval-Date Step B Appeal/Date Step B Impasse Regional Arb Scheduled], DateDiff("d",[StepBAppealDate],[DatePreArbAgreement]) AS [Time Interval-Date Step B Appeal/Date Step B Impasse Pre-Arb Agreement], DateDiff("d",[StepBAppealDate],[DateRegionalArbAward]) AS [Time Interval-Date Step B Appeal/Date Step B Impasse Regional Arb Award], DateDiff("d",[StepBAppealDate],[DateAppealedNationalArbitration]) AS [Time Interval-Date Step B Appeal/Date Step B Impasse Appealed National Arbitration], DateDiff("d",[StepBAppealDate],[DateNationalArbitrationScheduled]) AS [Time Interval-Date Step B Appeal/Date Step B Impasse National Arbitration Scheduled], DateDiff("d",[StepBAppealDate],[DateNationalArbAward]) AS [Time Interval-Date Step B Appeal/Date National Arbitration Award]

FROM tblMembers INNER JOIN tblGrievanceTrackingSystem ON tblMembers.MemberID = tblGrievanceTrackingSystem.MemberID;

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2017-08-03T03:30:01+00:00

    Thanks for the response.  I'm out of town currently.  I will try it next week ASAP.

    Robert

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-08-02T22:29:52+00:00

    I revised the original SQL to correct table names from: [Grievance Tracking System] to: tblGrievanceTrackingSystem and from: Members to tblMembers.  Before beginning to rename the 2 table in the original query, I got an: Inner Join error when I opened this query in design view.  I THINK I corrected the Inner Join error.  Now, I'm getting the error: not a valid alias name.  After clicking OK my insertion goes to the beginning of: tblGrievanceTrackingSystem.*,.

    What are the actual table names -- are they tblMembers and  tblGrievanceTrackingSystem something else?

    Try revising the query to like this --

    SELECT DateAdd("d",14,[IncidentDate]) AS [Last Day To Discuss At Informal A], DateAdd("d",7,[DiscussedDate]) AS ....   and see if it runs.

    I personally would not be using slashes in names but underscore instead.

    Was this answer helpful?

    0 comments No comments