The double quotes are wrong for the function, plus the SQL looks malformed..
did you try it, did you get an error message?
And I don't understand what/why you're using the replace...
but here's my shot..
INNER JOIN DE
WHERE CT.AreaCode= Replace(phoneSearch__areaVar, '''', '''''')
OR DE.AreaCode= Replace(phoneSearch__areaVar, '''', '''''')
AND CT.Number= Replace(phoneSearch__phoneVar, '''', '''''')
AND DE.Number= Replace(phoneSearch__phoneVar, '''', '''''')
SELECT * FROM dbo.RI WHERE (RI.AreaCode=areaVar and RI.Number=phoneVar) UNION SELECT* FROM dbo.MA where (MA.AreaCode=areaVar and MA.Number=phoneVar) UNION SELECT * FROM dbo.DE WHERE (DE.AreaCode=areaVar and DE.Number=phoneVar) UNION SELECT * FROM dbo.NH WHERE (NH.AreaCode=areaVar and NH.Number=phoneVar) UNION SELECT * FROM dbo.MD WHERE (MD.AreaCode=areaVar and MD.Number=phoneVar) UNION SELECT * FROM dbo.NY WHERE (NY.AreaCode=areaVar and NY.Number=phoneVar) UNION SELECT *
WHERE (PA.AreaCode=areaVar and PA.Number=phoneVar)
hey, sorry man. as i said, i am new to SQL and dynamic programming. i truly appreciate you responding to my questions though, other forums are not has helpful as this one. about the database structure, we are planning to do more with the database so setting in up in several tables was the best solution. this DB is used for the DO NOT CALL list (i am an intern at a mortage company that has a telemarketing dept). next time i post something, i will be sure to be as specific as i can.