Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the result of a DATEDIFF function from a query

Status
Not open for further replies.

ausmoran

MIS
Apr 8, 2001
157
US
I have a simple Select Query in which I have created a column usin the DATEDIFF function (LengthOfMembership: (DateDiff("yyyy",[JoinDate],Date()))

I would like to use the results of this in the development of a CROSSTAB query, however when I attempt to use this field (LengthOfMembership) in a subsequent query as part of a nested IIF statement, I cet a TYPE MISMATCH statement. Even if I use this field in a simple select query, and try to filter it (for example: "<5") I get a TYPE MISMATCH error.

I would really appreciate any advice or assistance that you might be able to offer. I've been fooling with this thing for hours now. Thanks in advance!!!!

Thanks,
Austin
 
Try putting single quotes around the 5: "<'5'"
I had something funky like this happen and this fixed it.
Not intuitive, but it worked.
HTH
JSouth

---------------------------------------
The customer may not always be right, but the customer is ALWAYS the customer.
 
Thanks for your reply! It turned out that I had a null entry in the JOIN_DATE field in the original table. URGGHHHHHH, something so simple and it choked!

Thanks again,
Austin
 
Thanks for letting us know what it was. I knew I was shooting in the dark on my response.
Have a great day, Austin!

---------------------------------------
The customer may not always be right, but the customer is ALWAYS the customer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top