Results 1 to 12 of 12
  1. #1
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20

    SELECT a "TWO WORD" field

    Hi guys,

    I have an Oracle DB and I am trying to run a simple SELECT query.
    The problem is that the field I want to select is named "REPORTER NAME", so two words obviously...


    I've tried quite a few different ways to do it but I still get a syntax error.

    So how should this look like?

    SELECT TABLE1.REPORTER NAME


    Thx

  2. #2
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    select [table1].[Reporter name]

    You can enclose all names with spaces using [ ], but most names should just be together like ReporterName or just 1 word.

  3. #3
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    That didn't do it either...still opens the pop up window in Access, asking for a parameter value for TABLE1.REPORTERNAME (I tried to put the words together). Otherwise I get the same pop up with REPORTER NAME instead...
    Here's what I've already used...

    [PUBLIC_VW_HR_JOB_POSITION].[REPORTERNAME]

    [PUBLIC_VW_HR_JOB_POSITION].[REPORTER NAME]

    [PUBLIC_VW_HR_JOB_POSITION].['REPORTER' 'NAME']

    [PUBLIC_VW_HR_JOB_POSITION].["REPORTER" "NAME"]

    [PUBLIC_VW_HR_JOB_POSITION].['REPORTER' || 'NAME']

  4. #4
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    If the field in the table is called: REPORTER NAME
    Then it should just be enclosed like : [REPORTER NAME]
    Also make sure the table name is spelt correctly and that the field name is in caps (Not sure if Access is Case Sensitive)
    Post the whole SQL statement if you can't get it to work.

  5. #5
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    Table name is correct, Access is not case sensitive but I wrote it properly anyway. The field name is REPORTER NAME

    Here is the whole thing. It actually runs like this:

    SELECT PUBLIC_HR_ASSOCIATE_DATA.ASSOCIATE_ID, PUBLIC_HR_ASSOCIATE_DATA.NAME_FIRSTNAME, PUBLIC_HR_ASSOCIATE_DATA.HIRING_DATE, PUBLIC_HR_ASSOCIATE_DATA.TRIAL_PERIOD, PUBLIC_HR_ASSOCIATE_DATA.DEPARTMENT, IIf([trial_period]<>0,CalcEvalDate(1,[Hiring_Date],[trial_period]),"trial period is over") AS FIRST_EVALUATION, IIf([trial_period]=12,CalcEvalDate(2,[Hiring_Date],[trial_period]),"") AS SECOND_EVALUATION, IIf([trial_period]<>0,CalcEvalDate(3,[Hiring_Date],[trial_period]),"") AS THIRD_EVALUATION
    FROM PUBLIC_HR_ASSOCIATE_DATA;

    Now, what I want to have is:

    SELECT PUBLIC_VW_JOB_POSITION.REPORTER NAME,
    PUBLIC_HR_ASSOCIATE_DATA.ASSOCIATE_ID, PUBLIC_HR_ASSOCIATE_DATA.NAME_FIRSTNAME, PUBLIC_HR_ASSOCIATE_DATA.HIRING_DATE, PUBLIC_HR_ASSOCIATE_DATA.TRIAL_PERIOD, PUBLIC_HR_ASSOCIATE_DATA.DEPARTMENT, IIf([trial_period]<>0,CalcEvalDate(1,[Hiring_Date],[trial_period]),"trial period is over") AS FIRST_EVALUATION, IIf([trial_period]=12,CalcEvalDate(2,[Hiring_Date],[trial_period]),"") AS SECOND_EVALUATION, IIf([trial_period]<>0,CalcEvalDate(3,[Hiring_Date],[trial_period]),"") AS THIRD_EVALUATION
    FROM PUBLIC_HR_ASSOCIATE_DATA;

  6. #6
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    SELECT PUBLIC_VW_JOB_POSITION.REPORTER_NAME,
    PUBLIC_HR_ASSOCIATE_DATA.ASSOCIATE_ID, PUBLIC_HR_ASSOCIATE_DATA.NAME_FIRSTNAME, PUBLIC_HR_ASSOCIATE_DATA.HIRING_DATE, PUBLIC_HR_ASSOCIATE_DATA.TRIAL_PERIOD, PUBLIC_HR_ASSOCIATE_DATA.DEPARTMENT, IIf([trial_period]<>0,CalcEvalDate(1,[Hiring_Date],[trial_period]),"trial period is over") AS FIRST_EVALUATION, IIf([trial_period]=12,CalcEvalDate(2,[Hiring_Date],[trial_period]),"") AS SECOND_EVALUATION, IIf([trial_period]<>0,CalcEvalDate(3,[Hiring_Date],[trial_period]),"") AS THIRD_EVALUATION
    FROM PUBLIC_HR_ASSOCIATE_DATA;


    Change the field name to match this REPORTER_NAME

    Also maybe i'm blind, but are you joining this table at any point? PUBLIC_VW_JOB_POSITION

  7. #7
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    Ooooooooops

  8. #8
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    In that case, Change the field name to match this:
    [PUBLIC_VW_JOB_POSITION].[REPORTER NAME]

    Regarding the Access DB Relationship manager, IF it still doesnt work, then try and join within the query. and see

  9. #9
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Quote Originally Posted by doci4a View Post
    Ooooooooops
    Does this mean you solved the problem?

  10. #10
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    Yup, I was so stuck on the syntax I forgot to add the second table in the FROM clause

    So that's okay.

    But after the join, it turned out I have a field called HIRING_DATE in both tables, which I use to calculate. And since there are two fields with the same name now...it crashes. Still trying to find a way around this.

    What I did was to try to add the correct table in front but no results still...

    IIf([trial_period]<>0,CalcEvalDate(1,[PUBLIC_HR_ASSOCIATE_DATA].[Hiring_Date],[trial_period]),"trial period is over") AS FIRST_EVALUATION,
    IIf([trial_period]=12,CalcEvalDate(2,[PUBLIC_HR_ASSOCIATE_DATA].[Hiring_Date],[trial_period]),"") AS SECOND_EVALUATION,
    IIf([trial_period]<>0,CalcEvalDate(3,[PUBLIC_HR_ASSOCIATE_DATA].[Hiring_Date],[trial_period]),"") AS THIRD_EVALUATION


  11. #11
    doci4a is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    20
    Problem solved though! Thanks for your help!

  12. #12
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Nice to see you solved it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-25-2012, 06:42 AM
  2. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  3. sql = "Select * From qry_defect" >> ??
    By anggunpus in forum Programming
    Replies: 2
    Last Post: 01-30-2010, 02:45 AM
  4. replace a empty field with the word "none" how??
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 11:02 AM
  5. Select "autonumbers" not in sequence
    By jerry525 in forum Queries
    Replies: 5
    Last Post: 11-09-2008, 02:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums