
Formula Error...URGENT, HELP HELP HELP... PLEASE
It sound like when you concatenate your IDStr together the field FromID and
ToID are being recognized as a numeric. You might want to try to force
single quotes around these fields. Something like this....
FromID = Str(ReportQuery.Text1.Text)
IDStr = "{EmpID.ID} >= '" & FromID **** added a single quote after
the >= ****
IDStr = IDStr & "' AND " **** added a single
quote before AND ****
ToID = Str(RptQuery.Text2.Text)
IDStr = IDStr & "{EmpID.ID} <= '" & ToID &"'" ****added & and a single
quote within double quotes at end of line ****
The resulting value for IDStr should now be .... {EmpID.ID} >= '1234' AND
{EmpID.ID <= '1550'
To verify, in your VB5.0 code put a breakpoint/watchpoint/or print to a
message box (I'm not familiar with VB5.0) the value of IDStr before calling
the Crystal Report and ensure that there are single quotes around the values
for FromID and ToID.
Try view on a full screen to see where I mad changes to your code (marked
with ****).
Hope this helps and is clear enough.
Tom
Quote:
>Hi,
>There are two USRE INPUT fields as FromID, ToID (an inquiry for
>Employees' IDs in a certain range. ie From: 1234 To: 1550)
>I have this code in VB5.0:
>Dim FromID as string 'List IDs From
>Dim ToID as string 'List IDs up to
>Dim IDStr as string
>FromID = Str(ReportQuery.Text1.Text)
>IDStr = "{EmpID.ID} >= " & FromID
>IDStr = IDStr & " AND "
>ToID = Str(RptQuery.Text2.Text)
>IDStr = IDStr & "{EmpID.ID} <= " & ToID
>.
>.
>.
>CrystalsReport1.DataFiles(0) = "C:\BUDGET\BUDGET.MDB"
>CrystalsReport1.SelectionFormula = IDStr
>.
>.
>.
>THEN I GOT THE FOLLOWING MESSAGE:
>ERROR IN FORMULA < Record_Selection>
>'{EmpID.ID} >= 1234 AND {EmpID.ID <= 1550'
>A string is required here
>MANY THANKS!
>Oga