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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2003 conversion - query criteria using function

Status
Not open for further replies.

trScott

Technical User
Dec 13, 2004
31
0
0
US
I recently converted my Access 97 database to Access 2003 and ran across the following problem:

In a reports recourse source, I was using a function in the recordsource as a criteria value. The function simply returns a constant from within my program. Per example: SELECT * FROM ABC WHERE year > getCurrentYear().

The public function getCurrentYear() returns the value for a public constant taxYear. In Access 97, it is returning records, but it returns no records in Access 2003. I hand checked the values and it should be returning records.

I did a little troubleshooting and converted the return value from the function into a long (Clng). This fixed the problem. Is there any way I can explicitly have Access convert values for me?

I have many reports/forms relying on these type of comparisons that worked in 97. It scares me that the report doesn't return an error, but just returns no records.
 
Something like this ?
Public Function getCurrentYear() [!]As Long[/!]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top