Help with a calculated field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know I'm missing something obvious, but I need help. I have calculated
fields msg1, msg2, and msg3. I want msg3 to equal msg2 if it exists (ie, not
null or ""), otherwise I want msg3 to equal msg1, regardless of its value.
What's a nice way to do this?

much appreciated
 
Try

Select Msg1, Msg2, IIf( Msg2 Is Null Or Trim(Msg2) = "", Msg1 , Msg2) As
Msg3 From TableName

Another way of seeing it, in the query create a new field

Msg3 : IIf( Msg2 Is Null Or Trim(Msg2) = "", Msg1 , Msg2)
 
Try

Select Msg1, Msg2, IIf( Msg2 Is Null Or Trim(Msg2) = "", Msg1 , Msg2) As
Msg3 From TableName
 
Try

Select Msg1, Msg2, IIf( Msg2 Is Null Or Trim(Msg2) = "", Msg1 , Msg2) As
Msg3 From TableName

Another way of seeing it, in the query create a new field

Msg3 : IIf( Msg2 Is Null Or Trim(Msg2) = "", Msg1 , Msg2)
 
Back
Top