Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call function from function- no values given for parameters

Status
Not open for further replies.

MrsMope

Technical User
Oct 18, 2004
125
US
Hi All,
I am attempting to pass a sql string to a function. The function then creates a recordset. what am I missing? I keep getting 'No value given for one or more parameters
Code:
Public Function FillCombo(FromDate As Date, ToDate As Date, SalesPerson As String, intOption As Integer)
Set cnnICInquiry = CurrentProject.Connection
Select Case intOption
    Case 1
    strSQL = "SELECT DISTINCT WB_COMM_ID from qryWaubeSalesSummary " & _
            strSQLDateFrom & FromDate & strSQLDateTo & ToDate & _
            strSQLSpID & SalesPerson & "'"
[red]            Call FillRecordset(strSQL)[/red]
Code:
[red]Public Function FillRecordset(SQL)[/red]
Set cnnICInquiry = CurrentProject.Connection
rstTemp.Open strSQL, cnnICInquiry, adOpenKeyset, adLockOptimistic

With rstTemp
 
FillRecordset's argument is SQL but you have strSQL in the Open method.
 
Golom,
THanks I changed that, so now the code for FillRecordset is:
Code:
Public Function FillRecordset(SQL)
rstTemp.Open SQL, cnnICInquiry, adOpenKeyset, adLockOptimistic

With rstTemp
I also checked the immediate window and SQL is showing as:
Code:
?SQL
SELECT DISTINCT WB_COMM_ID from qryWaubeSalesSummary WHERE WB_DATE_COMM_PROC >= #11/8/2005#  and WB_DATE_COMM_PROC <= #11/30/2005# and SLPRSNID= '109757         '

Still receive the same error
 
Is by chance qryWaubeSalesSummary a parametized query ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV
You are correct, I changed where I was pulling from to a table instead and I have no issues.

Do you happen to know if I wanted to pass a parameter from an option group how I would reference the value of the option group?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top