S
Sherwood
Greetings,
I am receiving the following error message when attempting to use the
code below:
Error Message - "Too few parameters. Expected 1."
My Code is as follows:
strSQLBorrowerLastName = "((([Loan].[BorrowerLastName]) Like ""*"" &
[Forms]![frmSearch]![txtBorrowerLastName] & ""*"" OR
([Forms]![frmSearch]![txtBorrowerLastName]) Is Null))"
strSQL = strSQLBorrowerLastName
strSQLTotal = "Select [Loan].[BorrowerLastName],[Loan].[BorrowerFirstName],
[Loan].[DepositDate], [Loan].[Branchcode], [Loan].[PropertyState],
[Loan].[LoanRepresentative], [Loan].[LoanNumber] FROM [Loan] WHERE " & strSQL
Set qdf = db.CreateQueryDef("qryTotalRecordsFound", strSQLTotal)
With qdf
'// The line below is where the error occurs.
Set rstTemp = .OpenRecordset(dbOpenSnapshot)
rstTemp.MoveFirst
nbr_of_records = rstTemp.RecordCount
rstTemp.Close
Set rstTemp = Nothing
End With
.....
Similar code seemed to work for me under Access 97, but under Access 2000
this fails. [Note: I tried using the "Eval" function, but was unable to get
the syntax correct for the "OR" portion of the SQL. If I don't use the OR
clause, the error message doesn't appear. However, I need to have the OR
clause so that the proper records are returned if a user leaves a field
null]. Any suggestions?
Thanks in advance!
Sherwood
I am receiving the following error message when attempting to use the
code below:
Error Message - "Too few parameters. Expected 1."
My Code is as follows:
strSQLBorrowerLastName = "((([Loan].[BorrowerLastName]) Like ""*"" &
[Forms]![frmSearch]![txtBorrowerLastName] & ""*"" OR
([Forms]![frmSearch]![txtBorrowerLastName]) Is Null))"
strSQL = strSQLBorrowerLastName
strSQLTotal = "Select [Loan].[BorrowerLastName],[Loan].[BorrowerFirstName],
[Loan].[DepositDate], [Loan].[Branchcode], [Loan].[PropertyState],
[Loan].[LoanRepresentative], [Loan].[LoanNumber] FROM [Loan] WHERE " & strSQL
Set qdf = db.CreateQueryDef("qryTotalRecordsFound", strSQLTotal)
With qdf
'// The line below is where the error occurs.
Set rstTemp = .OpenRecordset(dbOpenSnapshot)
rstTemp.MoveFirst
nbr_of_records = rstTemp.RecordCount
rstTemp.Close
Set rstTemp = Nothing
End With
.....
Similar code seemed to work for me under Access 97, but under Access 2000
this fails. [Note: I tried using the "Eval" function, but was unable to get
the syntax correct for the "OR" portion of the SQL. If I don't use the OR
clause, the error message doesn't appear. However, I need to have the OR
clause so that the proper records are returned if a user leaves a field
null]. Any suggestions?
Thanks in advance!
Sherwood