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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run time error on parameters

Status
Not open for further replies.

metalman

Programmer
Sep 17, 2001
35
US
getting a run time error of no value given for one or more required parameters.

Set sht = Worksheets("Detail")
For i = 1 To RowsCount
For j = 1 To ColsCount
sql_str = "SELECT Sum(Amount) as m " & _
"FROM Entry INNER JOIN Items ON Entry.ItemNum = Items.ItemNum " & _
gWhereStrArr(i) & "And Items.LCD='" & gColNameArr(j) & "'"


Set rs = New Recordset
Debug.Print sql_str
rs.Open sql_str, cn, adOpenStatic, adLockReadOnly

sht.Cells(i + 8, j + 1) = rs.fields("m")

rs.Close
Set rs = Nothing
Next j
Next i
 
sorry it errors on line:
rs.open SQL_str, cn, adopenstatic, adlockreadonly
 
Looks like you are missing part of your sql statement. The WHERE clause does not make any sense. Check it and try again.


sql_str = "SELECT Sum(Amount) as m "

sql_str=sql_str & "FROM Entry INNER JOIN Items ON Entry.ItemNum = Items.ItemNum "

sql_str=sql_str &<PROBLEM HERE!!!> & gWhereStrArr(i) & &quot;And Items.LCD='&quot; & gColNameArr(j) & &quot;'&quot;

&quot;WHERE something='&quot; seems to be missing.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top