PDA

Click to See Complete Forum and Search --> : SQL???


Cindy
Jun 29th, 1999, 09:50 PM
I have a database with two tables. I need to update one with and agency name. The other holds the agency names and ID numbers. How do I search the second table by ID number and to update the agency field in the first table? I tried this

strCriteria = "SELECT Agency_Name FROM Identification WHERE ACH_ID = "'" & IDNUM "'" '

But it doesn't work. I know little about SQL I am just trying it out. What am I doing wrong? Also, please be clear about the ' and " because it is hard to see them on the message board.

bashfirst
Jun 29th, 1999, 10:44 PM
What error are you getting with this?

Bash

David Ridgway
Jun 30th, 1999, 11:35 AM
The SQL should read as follows:

strCriteria = "SELECT Agency_Name FROM Identification
WHERE ACH_ID = '" & IDNUM & "'"

OR

strCriteria = "SELECT Agency_Name FROM Identification WHERE ACH_ID = " & IDNUM

Either one of these should work.

Hope this helps

David Ridgway
fdridgway@halifax.osp.com

David Ridgway
Jun 30th, 1999, 11:38 AM
I'll re-send the reply and space out the one that uses ' and "".

strCriteria = "SELECT Agency_Name
FROM Identification
WHERE ACH_ID = ' " & IDNUM & " ' "

Hope this helps

David Ridgway
fdridgway@halifax.osp.com