S
Steve W.
It's been several months since I programmed in VBA (and
then in Access 2000), but it seems to me that this used to
work. Has DAO changed somehow with Access 2002?
Private Sub btnConvert_Click()
Dim Rst As Recordset
Dim Qdf As QueryDef
Dim Parm As Parameter
Dim ORst As Recordset
Dim Db As Database
Set Db = CurrentDb()
Set Qdf = Db.QueryDefs("qry_Delete_OrdersNormal_by_Year")
Set Parm = Qdf.Parameters![Year?]
Parm = Me.tbxYear
Qdf.Execute
Set Qdf = Db.QueryDefs("qry_Orders_for_Conversion")
Qdf.Parameters(0).Value = Me.tbxYear
'Set Parm = Qdf.Parameters![Year?]
'Parm = Me.tbxYear
Set Rst = Qdf.OpenRecordset(dbOpenSnapshot)
1) Setting the value of a Query parameter doesn't work
the way I remember. What's wrong with the syntax in the
first attempt to set the Parm variable to the query parm...
Set Parm = Qdf.Parameters![Year?]
The query has a parm [Year?] set up for one column in the
base table. I get a "type mismatch" error on this line if
I use this syntax.
2) OK, no big deal, I can change to more awkward syntax
if I have to in setting the parm. In the second instance
of setting the Parm...
Qdf.Parameters(0) = Me.tbxYear ' (a form text box)
This works. But now on the immediately following line
Set Rst = Qdf.OpenRecordset(dbOpenSnapshot)
I get a "type mismatch" error on this line. Why!!!?
Thanks for your help.
Steve
PS. the column that the [Year?] query parm is in is an
integer value (but this never seemed to matter before and
I get the last crash even if I try to convert the value of
tbxYear to an Int before I set the parm).
then in Access 2000), but it seems to me that this used to
work. Has DAO changed somehow with Access 2002?
Private Sub btnConvert_Click()
Dim Rst As Recordset
Dim Qdf As QueryDef
Dim Parm As Parameter
Dim ORst As Recordset
Dim Db As Database
Set Db = CurrentDb()
Set Qdf = Db.QueryDefs("qry_Delete_OrdersNormal_by_Year")
Set Parm = Qdf.Parameters![Year?]
Parm = Me.tbxYear
Qdf.Execute
Set Qdf = Db.QueryDefs("qry_Orders_for_Conversion")
Qdf.Parameters(0).Value = Me.tbxYear
'Set Parm = Qdf.Parameters![Year?]
'Parm = Me.tbxYear
Set Rst = Qdf.OpenRecordset(dbOpenSnapshot)
1) Setting the value of a Query parameter doesn't work
the way I remember. What's wrong with the syntax in the
first attempt to set the Parm variable to the query parm...
Set Parm = Qdf.Parameters![Year?]
The query has a parm [Year?] set up for one column in the
base table. I get a "type mismatch" error on this line if
I use this syntax.
2) OK, no big deal, I can change to more awkward syntax
if I have to in setting the parm. In the second instance
of setting the Parm...
Qdf.Parameters(0) = Me.tbxYear ' (a form text box)
This works. But now on the immediately following line
Set Rst = Qdf.OpenRecordset(dbOpenSnapshot)
I get a "type mismatch" error on this line. Why!!!?
Thanks for your help.
Steve
PS. the column that the [Year?] query parm is in is an
integer value (but this never seemed to matter before and
I get the last crash even if I try to convert the value of
tbxYear to an Int before I set the parm).