D
dhoover via AccessMonster.com
I'm getting the error too few paremeters, 1 expected with the code below.
I'm getting the error at "
Set rst3 = dbs.OpenRecordset(strSQL3)". Any help would be much
appreciated
On Error GoTo Err_cmdCreateRecords_Click
Dim intResp As Integer
Dim intCount As Integer
If ReportDate = "" Or IsNull(ReportDate) Then
MsgBox "Please enter a valid report date."
ReportDate.SetFocus
GoTo Exit_cmdCreateRecords_Click
End If
intResp = MsgBox("This function will add records for the reporting date
specified. Do you wish to continue?", vbOKCancel, "Confirm Create Monthly
Records")
If intResp = 1 Then
Screen.MousePointer = 11
Dim dbs As Database
Dim strSQL As String
Dim strSQL2 As String
Dim strSQL3 As String
Dim rst As Recordset
Dim rst2 As Recordset
Dim rst3 As Recordset
Set dbs = CurrentDb
strSQL = "Select * from CheckinList "
strSQL2 = "Select * from [Customer Info] where [statusid] <> 2"
strSQL3 = "Select * from [Checkin query]where [reportingdate]= #" & Forms!
[CheckIn Date Form]!ReportDate & "#"
Set rst = dbs.OpenRecordset(strSQL)
Set rst2 = dbs.OpenRecordset(strSQL2)
Set rst3 = dbs.OpenRecordset(strSQL3)
intCount = 0
rst2.MoveFirst
Do Until rst2.EOF = True
rst.FindFirst "[CustomerID] = " & rst2![CustomerID]
rst2![CustomerID] = " & rst3![customerid]"
If rst.NoMatch Then
rst.AddNew
rst!ReportingDate = Forms![CheckIn Date Form]!ReportDate
rst!CustomerID = rst2!CustomerID
If rst2!LBR = "N/A" Then
rst!LBRRecd = "n/a"
End If
If rst2![A/R] = "N/A" Then
rst!ARAgingRecd = "n/a"
End If
If rst2![A/P] = "N/A" Then
rst!APAgingRecd = "n/a"
End If
If rst2!InvCert = "N/A" Then
rst!InventoryRecd = "n/a"
End If
If rst2!BalSheet = "N/A" Then
rst!BalanceRecd = "n/a"
End If
If rst2!IncomeStmt = "N/A" Then
rst!IncomeRecd = "n/a"
End If
'Test to see if Quarterly Reports are Due this period
If rst2![A/R1] = "Quarterly" And rst3!rst3![QtrDate1] <> rst3![QtrDueDate1]
And rst3![QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!ARAgingRecd1 = "n/a"
End If
If rst2![A/R1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And
rst3![QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!APAgingRecd1 = "n/a"
End If
If rst2![InvCert1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1]
And rst3![QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!InventoryRecd1 = "n/a"
End If
If [LBR1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And rst3!
[QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!LBRRecd1 = "n/a"
End If
If [INC1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And rst3!
[QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!IncomeRecd1 = "n/a"
End If
If [BAL1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And rst3!
[QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!BalanceRecd1 = "n/a"
End If
'Test to see if Quarterly Financals are Due this Period
If rst2![INC1] = "Quarterly" And rst3![FinDate1] <> rst3![FinDueDate1] And
rst3![FinDate1] <> rst3![FinDueDate2] _
And rst3![FinDate1] <> rst3![FinDueDate3] And rst3![FinDate1] <> rst3!
[FinDueDate4] Then
rst2!IncomeRecd1 = "n/a"
End If
If rst2![BAL1] = "Quarterly" And rst3![FinDate1] <> rst3![FinDueDate1] And
rst3![FinDate1] <> rst3![FinDueDate2] _
And rst3![FinDate1] <> rst3![FinDueDate3] And rst3![FinDate1] <> rst3!
[FinDueDate4] Then
rst2!BalanceRecd1 = "n/a"
End If
rst.Update
rst2.MoveNext
intCount = intCount + 1
Else
rst2.MoveNext
End If
Loop
If intCount > 0 Then
'Run modules to code the Checkinlist table status fields
[CheckInStatus].ReceivedRepts1
[CheckInStatus].MissingRepts1
[CheckInStatus].StatusTest1
End If
Screen.MousePointer = 0
MsgBox "Processing is Complete." & vbCrLf & vbCrLf & _
intCount & " Records have been created.", vbOKOnly, _
"Create Monthly Records Processing."
End If
'Move focus to OK button
cmdOK.SetFocus
Exit_cmdCreateRecords_Click:
Exit Sub
Err_cmdCreateRecords_Click:
Screen.MousePointer = 0
MsgBox Err.Description
Resume Exit_cmdCreateRecords_Click
I'm getting the error at "
Set rst3 = dbs.OpenRecordset(strSQL3)". Any help would be much
appreciated
On Error GoTo Err_cmdCreateRecords_Click
Dim intResp As Integer
Dim intCount As Integer
If ReportDate = "" Or IsNull(ReportDate) Then
MsgBox "Please enter a valid report date."
ReportDate.SetFocus
GoTo Exit_cmdCreateRecords_Click
End If
intResp = MsgBox("This function will add records for the reporting date
specified. Do you wish to continue?", vbOKCancel, "Confirm Create Monthly
Records")
If intResp = 1 Then
Screen.MousePointer = 11
Dim dbs As Database
Dim strSQL As String
Dim strSQL2 As String
Dim strSQL3 As String
Dim rst As Recordset
Dim rst2 As Recordset
Dim rst3 As Recordset
Set dbs = CurrentDb
strSQL = "Select * from CheckinList "
strSQL2 = "Select * from [Customer Info] where [statusid] <> 2"
strSQL3 = "Select * from [Checkin query]where [reportingdate]= #" & Forms!
[CheckIn Date Form]!ReportDate & "#"
Set rst = dbs.OpenRecordset(strSQL)
Set rst2 = dbs.OpenRecordset(strSQL2)
Set rst3 = dbs.OpenRecordset(strSQL3)
intCount = 0
rst2.MoveFirst
Do Until rst2.EOF = True
rst.FindFirst "[CustomerID] = " & rst2![CustomerID]
rst2![CustomerID] = " & rst3![customerid]"
If rst.NoMatch Then
rst.AddNew
rst!ReportingDate = Forms![CheckIn Date Form]!ReportDate
rst!CustomerID = rst2!CustomerID
If rst2!LBR = "N/A" Then
rst!LBRRecd = "n/a"
End If
If rst2![A/R] = "N/A" Then
rst!ARAgingRecd = "n/a"
End If
If rst2![A/P] = "N/A" Then
rst!APAgingRecd = "n/a"
End If
If rst2!InvCert = "N/A" Then
rst!InventoryRecd = "n/a"
End If
If rst2!BalSheet = "N/A" Then
rst!BalanceRecd = "n/a"
End If
If rst2!IncomeStmt = "N/A" Then
rst!IncomeRecd = "n/a"
End If
'Test to see if Quarterly Reports are Due this period
If rst2![A/R1] = "Quarterly" And rst3!rst3![QtrDate1] <> rst3![QtrDueDate1]
And rst3![QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!ARAgingRecd1 = "n/a"
End If
If rst2![A/R1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And
rst3![QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!APAgingRecd1 = "n/a"
End If
If rst2![InvCert1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1]
And rst3![QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!InventoryRecd1 = "n/a"
End If
If [LBR1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And rst3!
[QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!LBRRecd1 = "n/a"
End If
If [INC1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And rst3!
[QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!IncomeRecd1 = "n/a"
End If
If [BAL1] = "Quarterly" And rst3![QtrDate1] <> rst3![QtrDueDate1] And rst3!
[QtrDate1] <> rst3![QtrDueDate2] _
And rst3![QtrDate1] <> rst3![QtrDueDate3] And rst3![QtrDate1] <> rst3!
[QtrDueDate4] Then
rst2!BalanceRecd1 = "n/a"
End If
'Test to see if Quarterly Financals are Due this Period
If rst2![INC1] = "Quarterly" And rst3![FinDate1] <> rst3![FinDueDate1] And
rst3![FinDate1] <> rst3![FinDueDate2] _
And rst3![FinDate1] <> rst3![FinDueDate3] And rst3![FinDate1] <> rst3!
[FinDueDate4] Then
rst2!IncomeRecd1 = "n/a"
End If
If rst2![BAL1] = "Quarterly" And rst3![FinDate1] <> rst3![FinDueDate1] And
rst3![FinDate1] <> rst3![FinDueDate2] _
And rst3![FinDate1] <> rst3![FinDueDate3] And rst3![FinDate1] <> rst3!
[FinDueDate4] Then
rst2!BalanceRecd1 = "n/a"
End If
rst.Update
rst2.MoveNext
intCount = intCount + 1
Else
rst2.MoveNext
End If
Loop
If intCount > 0 Then
'Run modules to code the Checkinlist table status fields
[CheckInStatus].ReceivedRepts1
[CheckInStatus].MissingRepts1
[CheckInStatus].StatusTest1
End If
Screen.MousePointer = 0
MsgBox "Processing is Complete." & vbCrLf & vbCrLf & _
intCount & " Records have been created.", vbOKOnly, _
"Create Monthly Records Processing."
End If
'Move focus to OK button
cmdOK.SetFocus
Exit_cmdCreateRecords_Click:
Exit Sub
Err_cmdCreateRecords_Click:
Screen.MousePointer = 0
MsgBox Err.Description
Resume Exit_cmdCreateRecords_Click