I did have a reference set to DAO. But... taking the
reference to ActiveX Data Objects 2.1 from the reference
list worked. So I guess the syntax for the two data
access methods conflicts.
I ported my "old" database that I was working on before
from Access 97, so maybe that's why I hadn't encountered
this before.
Thanks for your help.
>-----Original Message-----
>You probably have not set a reference to DAO. See
Tools|References while in
>VBA Editor. Also, if you are not using ADO, you should
probably remove that
>reference. Otherwise, you need to preface your variables
with DAO, i.e.,
>DAO.Recordset.
>
>--
>Paul Overway
>Logico Solutions, LLC
>www.logico-solutions.com
>
>
>"Steve W." <(E-Mail Removed)> wrote in message
>news:1a8ff01c387b4$7c1af3b0$(E-Mail Removed)...
>> 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).
>
>
>.
>