W
Walter Steadman
I have a table and I am trying to get a query to create a value. sanfu
showed me how to get it to work with a sum funciton, but I am curious if I
can get the query to create a field with a date, based on a date equation.
I am trying to put the following in design mode of a query that has one
table below:
tblPilots
PilotID (PK)
LastName
FirstName
Birthmonth mm/dd/yyyy
I drag * into the design grid and then in the next block I put the
following:
starting: IIf(Month(Date()) >Month([birthmonth]),
(dateserial(year(date()-1), month([birthmonth]),
day([birthmonth])),(dateserial(year(date()), month([birthmonth]),
day([birthmonth])
doesn't this mean:
Expression: IIf(Month(Date()) >Month([birthmonth])
result if True: dateserial(year(date()-1), month([birthmonth]),
day([birthmonth]))
result if False: dateserial(year(date()), month([birthmonth]),
day([birthmonth])
I was thinking it would put the following in the new field called starting
Johns birthday is 15 Feb 65
it would put 15 Feb 05
Dan's birthday is 15 Nov 66
it would put 15 Nov 04
when I try to run this query I get the error:
the following expression you entered is missing a closing parenthasis,
bracket or vertical bar
I am using the iif function incorrectly? Can I have it create this type of
query?
When sanfu showed me it was about summing hours. Can you do an iif
statement in a query to create another field with additional data in it? so
that I don't have to store the data in a table?
TIA.
showed me how to get it to work with a sum funciton, but I am curious if I
can get the query to create a field with a date, based on a date equation.
I am trying to put the following in design mode of a query that has one
table below:
tblPilots
PilotID (PK)
LastName
FirstName
Birthmonth mm/dd/yyyy
I drag * into the design grid and then in the next block I put the
following:
starting: IIf(Month(Date()) >Month([birthmonth]),
(dateserial(year(date()-1), month([birthmonth]),
day([birthmonth])),(dateserial(year(date()), month([birthmonth]),
day([birthmonth])
doesn't this mean:
Expression: IIf(Month(Date()) >Month([birthmonth])
result if True: dateserial(year(date()-1), month([birthmonth]),
day([birthmonth]))
result if False: dateserial(year(date()), month([birthmonth]),
day([birthmonth])
I was thinking it would put the following in the new field called starting
Johns birthday is 15 Feb 65
it would put 15 Feb 05
Dan's birthday is 15 Nov 66
it would put 15 Nov 04
when I try to run this query I get the error:
the following expression you entered is missing a closing parenthasis,
bracket or vertical bar
I am using the iif function incorrectly? Can I have it create this type of
query?
When sanfu showed me it was about summing hours. Can you do an iif
statement in a query to create another field with additional data in it? so
that I don't have to store the data in a table?
TIA.