C
Chris
The following is a sub I created. I am getting an error on
the Select Statement I am using that stats "Too Few
Parameters. Expected 1."
As far as I can tell my Select statement has the correct
sytax and when I run the SQL Select statement in a regular
query window it works fine.
Any help is appreciated.
Thanks,
-Chris
Sub Compare_Loan()
Dim D As Database, R As Form, T As Recordset, C As
Recordset
Dim strHud As Integer
Dim strIED As Integer
Dim strHID As Integer
Dim strFID As Integer
Dim strTax As Integer
Dim strFull As Integer
Dim strMessage As Variant
Dim strTotal As Integer
Set D = CurrentDb
'Set R = [Forms]![frmMain]
Set R = [Forms]![frmMain]
Set T = D.OpenRecordset("tblCompare")
DoCmd.SetWarnings False
DoCmd.OpenQuery ("qryDelCompare")
DoCmd.SetWarnings True
T.AddNew
T![Loan_Num] = R![Loan_Number]
T.Update
strHud = 0
strIED = 0
strHID = 0
strFID = 0
strTax = 0
strFull = 0
Set C = D.OpenRecordset("Select * from [tblMain] Where
[Loan_Number] = R![Loan_Number]);", dbOpenSnapshot)
If C![Hud-1] = True Then
strHud = strHud + 1
If C![Initial_Escrow_Disclosure] = True Then
strIED = strIED + 1
If C![Hazard_Insurance_Declaration] = True Then
strHID = strHID + 1
If C![Flood_Insurance_Declaration] = True Then
strFID = strFID + 1
If C![Tax_Certification] = True Then
strTax = strTax + 1
If C![Full_File] = True Then
strFull = strFull + 1
End If
End If
End If
End If
End If
End If
strTotal = strHud + strIED + strHID + strFID + strTax +
strFull
If strTotal > 0 Then
If strHud > 0 Then
strMessage = strMessage + "Hud-1 "
If strIED > 0 Then
strMessage = strMessage + "Initial Escrow Disclosure "
If strHID > 0 Then
strMessage = strMessage + "Hazard Insurance
Declaration "
If strFID > 0 Then
strMessage = strMessage + "Flood Insurance
Declaration "
If strTax > 0 Then
strMessage = strMessage + "Tax Certification "
If strFull > 0 Then
strMessage = strMessage + "Full File "
End If
End If
End If
End If
End If
End If
End If
Dim UserSelection1
UserSelection1 = MsgBox(("The Documents you Requested " &
strMessage & " Have Been Previously Requested and are in
the File Cabinet. Do you want to re-request them?"),
vbYesNo)
Select Case UserSelection1
Case 6 'if yes is selected
GoTo Continue
Case 7 'if no is selected
DoCmd.Quit
End Select
Continue:
Exit Sub
End Sub
the Select Statement I am using that stats "Too Few
Parameters. Expected 1."
As far as I can tell my Select statement has the correct
sytax and when I run the SQL Select statement in a regular
query window it works fine.
Any help is appreciated.
Thanks,
-Chris
Sub Compare_Loan()
Dim D As Database, R As Form, T As Recordset, C As
Recordset
Dim strHud As Integer
Dim strIED As Integer
Dim strHID As Integer
Dim strFID As Integer
Dim strTax As Integer
Dim strFull As Integer
Dim strMessage As Variant
Dim strTotal As Integer
Set D = CurrentDb
'Set R = [Forms]![frmMain]
Set R = [Forms]![frmMain]
Set T = D.OpenRecordset("tblCompare")
DoCmd.SetWarnings False
DoCmd.OpenQuery ("qryDelCompare")
DoCmd.SetWarnings True
T.AddNew
T![Loan_Num] = R![Loan_Number]
T.Update
strHud = 0
strIED = 0
strHID = 0
strFID = 0
strTax = 0
strFull = 0
Set C = D.OpenRecordset("Select * from [tblMain] Where
[Loan_Number] = R![Loan_Number]);", dbOpenSnapshot)
If C![Hud-1] = True Then
strHud = strHud + 1
If C![Initial_Escrow_Disclosure] = True Then
strIED = strIED + 1
If C![Hazard_Insurance_Declaration] = True Then
strHID = strHID + 1
If C![Flood_Insurance_Declaration] = True Then
strFID = strFID + 1
If C![Tax_Certification] = True Then
strTax = strTax + 1
If C![Full_File] = True Then
strFull = strFull + 1
End If
End If
End If
End If
End If
End If
strTotal = strHud + strIED + strHID + strFID + strTax +
strFull
If strTotal > 0 Then
If strHud > 0 Then
strMessage = strMessage + "Hud-1 "
If strIED > 0 Then
strMessage = strMessage + "Initial Escrow Disclosure "
If strHID > 0 Then
strMessage = strMessage + "Hazard Insurance
Declaration "
If strFID > 0 Then
strMessage = strMessage + "Flood Insurance
Declaration "
If strTax > 0 Then
strMessage = strMessage + "Tax Certification "
If strFull > 0 Then
strMessage = strMessage + "Full File "
End If
End If
End If
End If
End If
End If
End If
Dim UserSelection1
UserSelection1 = MsgBox(("The Documents you Requested " &
strMessage & " Have Been Previously Requested and are in
the File Cabinet. Do you want to re-request them?"),
vbYesNo)
Select Case UserSelection1
Case 6 'if yes is selected
GoTo Continue
Case 7 'if no is selected
DoCmd.Quit
End Select
Continue:
Exit Sub
End Sub