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!

Error 20515 Help

Status
Not open for further replies.

B1naryPro

IS-IT--Management
Jan 20, 2002
114
0
0
US
Visual basic code that i pass to crystal reports. when i pass the stroption = "CLOSED" i get the error message stating run time error '20515'

If IsDate(txtStartDate) And IsDate(txtEndDate) Then
dteReturnValue = txtStartDate
dteReturnValue2 = txtEndDate
strControl = Format$(dteReturnValue, "yyyymmdd")
strControl2 = Format$(dteReturnValue2, "yyyymmdd")
strFormula = "{CAO.DateReceived} in Date(" & Left(strControl, 4) & "," & Mid(strControl, 5, 2) & "," & Right(strControl, 2) & ") to Date(" & Left(strControl2, 4) & ", " & Mid(strControl2, 5, 2) & "," & Right(strControl2, 2) & ")" & " and {CAO.Assignee} = '" & (cboAssignee.Text) & "'"
'OPEN ITEMS ONLY
If optOpen(0).Value = True Then
strOption = "ISNULL"
strFormula = strFormula & " and " & strOption & "({CAO.DateClosed})"
End If
'CLOSED ITEMS ONLY
If optOpen(1).Value = True Then
strOption = "Closed"
strFormula = strFormula & " and " & strOption & "({CAO.DateClosed})"
End If

Much help needed

JPBinary
MCSE, MCSA
 
Doesn't make sense why it would work.

Assuming {CAO.DateClosed} is a date, you wouldn't use the syntax:

and closed({cao.DateClosed})

which is the result of the closed clause.

Perhaps you're just trying to determine if it does have a date, simplify:

'OPEN ITEMS ONLY
If optOpen(0).Value = True Then
strFormula = strFormula & " and isnull({CAO.DateClosed})"
Else
strFormula = strFormula & " and not(isnull({CAO.DateClosed}))"
End If

The StrOption isn't needed.

-k
 
appreciate the help but what i want is to pass the variable either closed or pending to crystal reports. there is no IsNull because there will be some type of data in that fields. I'm sorry if it's confusing.

thanks

JPBinary
MCSE, MCSA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top