ZanM
Jun 14th, 2000, 11:21 PM
I have a sql string that calculates the number of day between two times...
SELECT ClientData.Name, ClientData.Address, ClientData.CustomerType, ClientData.LastWork, ClientData.NextScheduled, ClientData.JobStatus, DateDiff("d",Now(),[clientdata].[nextscheduled]) AS Expr1
FROM ClientData
WHERE (((DatePart("m",[CLIENTDATA].[NEXTSCHEDULED])) Like DatePart("m",Now())) AND ((DatePart("yyyy",[CLIENTDATA].[NEXTSCHEDULED])) Like DatePart("yyyy",Now())))
ORDER BY ClientData.Name;
I need to modify it to format the number of days into years or months some how
this is the SQL statement that is actually used (the above is used to difine fields for a report
Dim nReport As New Report
If txtYear.Text = " " Or txtYear.Text = "" Then
MsgBox "Please enter the year you wish to Search....", , "User Error.."
Exit Sub
End If
If Len(txtYear.Text) < 4 Then
MsgBox "You must enter the full numerical date. I.E. 2001....", , "User Error..."
Exit Sub
End If
Dim sMonth As String
sMonth = Trim(Left(lstMonth.Text, 2))
If CInt(sMonth) < 1 Or CInt(sMonth) > 12 Then
Beep
MsgBox "You must select a month from the list.", , "User Error..."
Exit Sub
End If
ClientDataEnvir.Commands("MonthlyReport").CommandText = "SELECT ClientData.Name, ClientData.Address, ClientData.CustomerType, ClientData.LastWork, ClientData.NextScheduled, ClientData.JobStatus, DateDiff('d',Now(),[clientdata].[nextscheduled]) AS Expr1 From ClientData Where (((DatePart('m', [ClientData].[NEXTSCHEDULED])) Like " & "'" & sMonth & "'" & ") And ((DatePart('yyyy', [ClientData].[NEXTSCHEDULED])) Like " & "'" & txtYear.Text & "'" & "))ORDER BY ClientData.Name;"
Set nReport.DataSource = ClientDataEnvir
nReport.DataMember = "MonthlyReport"
ClientDataEnvir.rsMonthlyReport.Close 'Makes sure you open a new data stream
' nReport.Refresh
nReport.Show
SELECT ClientData.Name, ClientData.Address, ClientData.CustomerType, ClientData.LastWork, ClientData.NextScheduled, ClientData.JobStatus, DateDiff("d",Now(),[clientdata].[nextscheduled]) AS Expr1
FROM ClientData
WHERE (((DatePart("m",[CLIENTDATA].[NEXTSCHEDULED])) Like DatePart("m",Now())) AND ((DatePart("yyyy",[CLIENTDATA].[NEXTSCHEDULED])) Like DatePart("yyyy",Now())))
ORDER BY ClientData.Name;
I need to modify it to format the number of days into years or months some how
this is the SQL statement that is actually used (the above is used to difine fields for a report
Dim nReport As New Report
If txtYear.Text = " " Or txtYear.Text = "" Then
MsgBox "Please enter the year you wish to Search....", , "User Error.."
Exit Sub
End If
If Len(txtYear.Text) < 4 Then
MsgBox "You must enter the full numerical date. I.E. 2001....", , "User Error..."
Exit Sub
End If
Dim sMonth As String
sMonth = Trim(Left(lstMonth.Text, 2))
If CInt(sMonth) < 1 Or CInt(sMonth) > 12 Then
Beep
MsgBox "You must select a month from the list.", , "User Error..."
Exit Sub
End If
ClientDataEnvir.Commands("MonthlyReport").CommandText = "SELECT ClientData.Name, ClientData.Address, ClientData.CustomerType, ClientData.LastWork, ClientData.NextScheduled, ClientData.JobStatus, DateDiff('d',Now(),[clientdata].[nextscheduled]) AS Expr1 From ClientData Where (((DatePart('m', [ClientData].[NEXTSCHEDULED])) Like " & "'" & sMonth & "'" & ") And ((DatePart('yyyy', [ClientData].[NEXTSCHEDULED])) Like " & "'" & txtYear.Text & "'" & "))ORDER BY ClientData.Name;"
Set nReport.DataSource = ClientDataEnvir
nReport.DataMember = "MonthlyReport"
ClientDataEnvir.rsMonthlyReport.Close 'Makes sure you open a new data stream
' nReport.Refresh
nReport.Show