|
-
Apr 9th, 2007, 03:49 PM
#1
Thread Starter
PowerPoster
Crystal Reports 10.2 Error in SelectionFormula???
I have attached the Error Message as a Word Doc so it can be viewed. I'm not sure if the Selection Formula is syntactically correct. I've also included the code that generates the report below:
Code:
Public Sub TimeByProject(ByVal intMO As Integer, ByVal intYR As Integer)
Try
strModule = "modReporting"
Dim crDOC As New rptTimeByProject
Dim strSelectionFormula As String = ""
crConnectionInfo = New ConnectionInfo
With crConnectionInfo
.ServerName = "ServerName"
.DatabaseName = "SCTime"
.IntegratedSecurity = True
End With
crDB = crDOC.Database
crTables = crDB.Tables
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
frmReports.rptViewer.DisplayGroupTree = False
strSelectionFormula = "month({tblTimeSheetDetail.beginPeriodDate}) = " & intMO & " AND year({tblTimeSheetDetail.beginPeriodDate}) = " & intYR
crDOC.RecordSelectionFormula = strSelectionFormula
frmReports.rptViewer.ReportSource = crDOC
frmReports.ShowDialog()
crDOC = Nothing
crDB = Nothing
crTables = Nothing
crConnectionInfo = Nothing
Catch ex As Exception
End Try
End Sub
-
Apr 9th, 2007, 05:30 PM
#2
Thread Starter
PowerPoster
Re: Crystal Reports 10.2 Error in SelectionFormula???
-
Apr 10th, 2007, 12:45 AM
#3
Re: Crystal Reports 10.2 Error in SelectionFormula???
Well, based on the error message, Crystal does not recognize that the {tblTimeSheetDetail.beginPeriodDate} field is a Date/Time field.
Check the database. Is it a date/time field or perhaps its a string field that contains date data?
Has the database changed after the report was initially created?
-
Apr 10th, 2007, 09:00 AM
#4
Thread Starter
PowerPoster
Re: Crystal Reports 10.2 Error in SelectionFormula???
Bruce,
It's a field that contains a date value, however, it's type is not a datetime.
-
Apr 10th, 2007, 09:51 AM
#5
Re: Crystal Reports 10.2 Error in SelectionFormula???
Then, to use the Month, Year functions you need to convert the field to a datetime data type. You could also use String functions Left, Right, Mid) to parse out the date part values.
month(cdate({tblTimeSheetDetail.beginPeriodDate}))
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|