Acc97, SQL, IF Statements in Queries

  • Thread starter Thread starter hyperactifone
  • Start date Start date
H

hyperactifone

Guest
I am trying to code an if statement into a select query. the code for which is below : The code works but not correctly. Some of the fields in FN2 are blank so the query leaves the merged field empty too. This is NOT the desired effect. I know i need to put an IF statement in but everything I try seems to make it refuse to run and throw up errors.

Please help.

Code :
------

SELECT [FN1]+" "+[FN2] AS Expr1
FROM centres AS centname;

Thanks in Advance
 
I assume that [FN1] and [FN2] are text fields, yes? If not this may need to be altered.

SELECT Nz([FN1],"") & " " & Nz([FN2],"") AS Expr1
FROM centres AS centname;
 
Thanks Abby.

Now all I have to do is get the output from the now working correctly SQL into a field in another table.

I have tried all kinds of queries and had very little success with them. They usually give no output. The table I am trying to get data into is empty at the moment. The primary key is one of the fields I need to copy information into.

Thanks again in anticipation.

[This message has been edited by hyperactifone (edited 08-21-2001).]
 

Users who are viewing this thread

Back
Top Bottom