Error 20515 when run CR9 from Vb6 and Access2000
I have code as below:
Dim strEnterMon As String
strEnter = InputBox("Enter the month and the year of the leave anniversary date", "Please Enter The MM/YYYY Formart", "02/2004")
If Len(strEnter) <> 0 Then
strEnterMon = Format(strEnter, "mm/yyyy")
Dim drs1 As Recordset
Set drs1 = db.OpenRecordset("SELECT LName, FName, MI, LeaveAnnDate, SSN, Locator, EmplTime FROM Employee WHERE Year(LeaveAnnDate) = Cint('" & Mid(strEnterMon, 4, 4) & "') and Month (LeaveAnnDate) = Cint('" & Mid(strEnterMon, 1, 2) & "');")
If drs1.RecordCount <> 0 Then
MousePointer = 11
CryReport.ReportFileName = App.Path & "/LeaveAnnMon.rpt"
CryReport.WindowTitle = "Employee leave anniversary Date By leave anniversary Month and leave anniversary Year"
CryReport.Formulas(0) = "ReportTitle = 'EMPLOYEE LEAVE ANNIVERSARY FOR " & strEnter & "'"
CryReport.Formulas(1) = "Yea = '" & Mid(strEnterMon, 4, 4) & "'"
CryReport.Formulas(2) = "Mon = '" & Mid(strEnterMon, 1, 2) & "'"
CryReport.WindowState = 2
CryReport.SelectionFormula = "{@LeaveAnnyear}= ToNumber({@Yea}) and {@LeaveAnnmon}= ToNumber({@Mon}) and {qryEmp.Status}='ACTIVE'"
CryReport.Action = 1
MousePointer = 1
Else
MsgBox "No employee matching the year and the month of the leave anniversary date!"
Exit Sub
End If
There are no problem with VB5 and CR7. What changes should be made in VB6. I'm using Access 2000.
Thanks for any help.
|