Query Field Heading

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

Guest

Is it possible to create a field that is based on the results of an if
expresion.

IE I have three fields imported from a table. Value Number Day. I want to
create another field that will result in 1 being entered if the number = 2 on
a Tuesday.

Thanks
 
fred said:
Is it possible to create a field that is based on the results of an if
expresion.

IE I have three fields imported from a table. Value Number Day. I want to
create another field that will result in 1 being entered if the number = 2 on
a Tuesday.


Sure, just enter an expression in a blank field in the
query's design grid. The expression might be something
like:

fldT1: IIf([Number] = 2 And [Day] = "Tuesday", 1, Null)
 
Is it possible to create a field that is based on the results of an if
expresion.

IE I have three fields imported from a table. Value Number Day. I want to
create another field that will result in 1 being entered if the number = 2 on
a Tuesday.

Thanks

Well so far you have struck out the 3 fields. :-(

Value, Number, and Day are reserved Access/VBA/Jet word and should not
be used as field names.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access
286335 'ACC2002: Reserved Words in Microsoft Access
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words

I don't follow your question. What do you mean by
"if the number = 2 on a Tuesday"?

Does that mean you want the new field to show a 1 if the query is run
on a Tuesday? What about Monday and Wednesday, etc.?

Change all the field names then post back with the new names and a bit
more information.
 
Back
Top