B
Bill Phillips
I have a module that returns a specified field from an array. I have used it
repeatedly so I know it works correctly. I am trying to call the module from
a SQL statement and it keeps prompting me for one of the module arguments and
I do not understand why.
The module code is as follows:
Public Function SplitItDbl(ByVal lngNdx As Long, ByVal strSplit As String)
As Double
Dim varSplit As Variant
varSplit = Split(strSplit, ";")
SplitItDbl = varSplit(lngNdx)
End Function
The SQL call is as follows:
strSQLSlsAmt = "INSERT INTo tblItemSlsDet (SalesAmt) " & _
"SELECT SplitItDbl(lintMonthEval,ZIndexSMSEW.salesamt) as
SalesAmt " & _
"FROM ZIndexSMSEW " & _
"WHERE ZIndexSMSEW.cono = '" & intCono & "' AND
ZIndexSMSEW.whse = '" & strWhse & "' AND ZIndexSMSEW.custno = '" & lintCustno
& "' AND ZIndexSMSEW.yr = '" & intSalesYear & "' AND ZIndexSMSEW.prod = '" &
strItemID & "'"
I am using the DoCmd.RunSQL to run the SQL statement. Whenever I try to call
this module I get prompted for lintMonthEval which is the index number of the
month I am evaluating.
Thanks in advance,
repeatedly so I know it works correctly. I am trying to call the module from
a SQL statement and it keeps prompting me for one of the module arguments and
I do not understand why.
The module code is as follows:
Public Function SplitItDbl(ByVal lngNdx As Long, ByVal strSplit As String)
As Double
Dim varSplit As Variant
varSplit = Split(strSplit, ";")
SplitItDbl = varSplit(lngNdx)
End Function
The SQL call is as follows:
strSQLSlsAmt = "INSERT INTo tblItemSlsDet (SalesAmt) " & _
"SELECT SplitItDbl(lintMonthEval,ZIndexSMSEW.salesamt) as
SalesAmt " & _
"FROM ZIndexSMSEW " & _
"WHERE ZIndexSMSEW.cono = '" & intCono & "' AND
ZIndexSMSEW.whse = '" & strWhse & "' AND ZIndexSMSEW.custno = '" & lintCustno
& "' AND ZIndexSMSEW.yr = '" & intSalesYear & "' AND ZIndexSMSEW.prod = '" &
strItemID & "'"
I am using the DoCmd.RunSQL to run the SQL statement. Whenever I try to call
this module I get prompted for lintMonthEval which is the index number of the
month I am evaluating.
Thanks in advance,