L
Lambi000
I have the following VB code that is giving me an error message:
Run-time error '424'
Object Required
It doesn't llike my Set frm statement, as if the object doesn't exist. But
exist it does as it's running other queries (it's a report parameter screen).
I suspect there's something amiss with my references as I've had to assign
some really simple ones like DAO 3.6, etc. What am I doing wrong to get this
message?
The code is below:
Public Function Combo_List()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("qryMultiSelect")
Set frm = Form![Report Parameters] *THIS IS WHERE IT DIES*
Set ctl = frm!List90
Set ctl1 = frm!Text94
strSQL = "Select * from Purchasing where [TTYPE]="
'Concatenate to strSQL
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " OR [TTYPE]="
Next varItem
'Trim the end of strSQL
strSQL = Left$(strSQL, Len(strSQL) - 12)
DoCmd.OpenQuery "qryMultiSelect", , acReadOnly
Set db = Nothing
Set qdf = Nothing
End Function
Help!
Thanks in advance.
Run-time error '424'
Object Required
It doesn't llike my Set frm statement, as if the object doesn't exist. But
exist it does as it's running other queries (it's a report parameter screen).
I suspect there's something amiss with my references as I've had to assign
some really simple ones like DAO 3.6, etc. What am I doing wrong to get this
message?
The code is below:
Public Function Combo_List()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("qryMultiSelect")
Set frm = Form![Report Parameters] *THIS IS WHERE IT DIES*
Set ctl = frm!List90
Set ctl1 = frm!Text94
strSQL = "Select * from Purchasing where [TTYPE]="
'Concatenate to strSQL
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " OR [TTYPE]="
Next varItem
'Trim the end of strSQL
strSQL = Left$(strSQL, Len(strSQL) - 12)
DoCmd.OpenQuery "qryMultiSelect", , acReadOnly
Set db = Nothing
Set qdf = Nothing
End Function
Help!
Thanks in advance.