Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Posts
    34

    Wink Unanswered: SQL Join Question

    I currently have a report that is showing codes and I need to show a description that matches that code on the report also. I am using a table to create the report. The table is getting created by:

    [DB.Execute "INSERT INTO TableUsedForReport( VarNum ) SELECT FirstTable.*, " & _
    "SecondTable.VarNum FROM FirstTable INNER JOIN SecondTable ON FirstTable.BROA = " & _
    "SecondTable.[Account#];" ]

    What I would now like to do is insert a description into that table for two different fields (PRN and INC):

    ['DB.Execute "UPDATE TableUsedForReport INNER JOIN DescriptionTable ON TableUsedForReport.CC-INC = DescriptionTable.Number SET TableUsedForReport.CC-INC-DESC = DescriptionTable.Name;"

    'DB.Execute "UPDATE TableUsedForReport INNER JOIN DescriptionTable ON TableUsedForReport.CC-PRN = DescriptionTable.Number SET TableUsedForReport.CC-PRN-DESC = DescriptionTable.Name;" ]

    I would appreciate any help...right now I am getting a syntax error for these update statements.

    Thanks!
    Kelly
    "If you are good you will be assigned all the work. If you are really good you will get out of it."

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Have you tried using brackets?

    I think it may be trying to perform an operation on those strings because of the '-'

    something more like:

    UPDATE Table INNER JOIN descTable ON [Table].[CC-INC] = [DescTable].[Number] SET Table.[CC-INC-DESC] = descTable.Name


    Give that a whirl

  3. #3
    Join Date
    Nov 2003
    Posts
    34

    Thank You!

    Your the smartest person alive! Me and my boss thank you...and I feel really dumb for not catching that. LOL.

    Thanks!
    Kelly
    "If you are good you will be assigned all the work. If you are really good you will get out of it."

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Thank You!
    Your the smartest person alive! Me and my boss thank you...and I feel really dumb for not catching that. LOL.

    Thanks!
    Kelly
    Glad I could help!!

    Access is extremely finicky with that sort of thing. That was a very easy and understandable mistake to make.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •