Formula Error...URGENT, HELP HELP HELP... PLEASE 
Author Message
 Formula Error...URGENT, HELP HELP HELP... PLEASE

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



Tue, 21 Nov 2000 03:00:00 GMT  
 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



Tue, 21 Nov 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. Formula Error - URGENT, PLEASE HELP....

3. Formula Error - URGENT, PLEASE HELP.....

4. Urgent Help Help Help please

5. PLEASE HELP PLEASE HELP PLEASE HELP

6. Formula Error - URGNET, PLEASE HELP.....

7. help,help,help,help,help,help,help,help,help,help,help,help,help,

8. URGENT...HELP WITH DATABASE.........Please help!!

9. Urgent help needed please help

10. URGENT help needed, please help

11. PLEASE HELP - MKS MKD etc - Urgent Help Required

12. Urgent help needed please help

 

 
Powered by phpBB® Forum Software