Guest_imported
New member
- Jan 1, 1970
- 0
I am trying to set up a report to print information according to a menu selection provided to a user. Therefore, the condition will not be known beforehand. So, using Select Case, the program stores a text string to the variable named rptcontrol. I then attempted to add the variable to the end of an existing SELECT statement using the EVAL() function. The code below is an example of what I am trying to do. The last EVAL function is the one that is producing an error. The text following the asterisk is an example of what value the rptcontrol variable may contain (including quotes (""))
*** rptcontrol = "len(ltrim(rtrim(accnum))) >=4"
---------------------------------------------------------
Set Rs = Db.OpenRecordset("SELECT Count([Accident Data].[City or County])
AS City
FROM [Accident Data] HAVING ((([Accident Data].Date) Between Eval('[forms]![CitySmryDates]![Beginning Date]') And Eval('[forms]![CitySmryDates]![Ending Date]')) AND (([Accident Data].[City or County])='City' AND eval(rptcontrol)))"
-----------------------------------------------------------
The error that I am getting is:
"Too few arguments". Expected 1"
Before I added the eval(rptcontrol) statement, I did not receive any errors. What am I doing wrong.
*** rptcontrol = "len(ltrim(rtrim(accnum))) >=4"
---------------------------------------------------------
Set Rs = Db.OpenRecordset("SELECT Count([Accident Data].[City or County])
AS City
FROM [Accident Data] HAVING ((([Accident Data].Date) Between Eval('[forms]![CitySmryDates]![Beginning Date]') And Eval('[forms]![CitySmryDates]![Ending Date]')) AND (([Accident Data].[City or County])='City' AND eval(rptcontrol)))"
-----------------------------------------------------------
The error that I am getting is:
"Too few arguments". Expected 1"
Before I added the eval(rptcontrol) statement, I did not receive any errors. What am I doing wrong.