Discussion:
Converting old DAO syntax (i.e. Openquerydef)
(too old to reply)
JGawlik
2008-02-10 00:54:05 UTC
Permalink
I have been called to convert an old Access 97 database to Access 2003. I
haven't worked in Access for a long time and would appreciate a push in the
right direction.

I've converting the data and code databases and got them linked. When I
compile the code, it stops on the OpenQueryDef line:

Set qs = db.OpenQueryDef("qryAppend Billed_Fees Snapshot")
qs.Parameters("FisYear") = FisYear
qs.Execute
qs.Close

How do I re-write this? There are dozens of them in the whole project. I
know it might use CreateQueryDef but is there anything else besides
replacing that?

Is there a good location somewhere with a listing of all the old syntax and
how to replace it? I'm sure this is just the beginning!

Is there any benefit to activating the DAO 2.5/3.51 compatibility Library?

Thanks!
Jackie
JGawlik
2008-02-10 01:25:45 UTC
Permalink
I found somewhere that I had to replace OpenqueryDef with QueryDefs in my
example. Now I get:
Method or data member not found on the rs.CLNT_MATT_CODE line.

Do Until rs.EOF
If rs.CLNT_MATT_CODE = "99912.00001" Then ' vacation
MtdVc = rs(PeriodStr)
YtdVc = rs("Total")
End If

I assume there is something wrong with one of the lines here. Some more
obsolete syntax?
Dim db As Database
Dim rs As Recordset
Dim qs As QueryDef
Dim PeriodStr As String

Set db = DBEngine(0)(0)
Set qs = db.QueryDefs("qry rpt at10 days out")
qs.Parameters("EmplUno") = [EmplUno]
qs.Parameters("FisYear") = FisYear
qs.Parameters("Period") = Period
Set rs = qs.OpenRecordset()
Post by JGawlik
I have been called to convert an old Access 97 database to Access 2003. I
haven't worked in Access for a long time and would appreciate a push in the
right direction.
I've converting the data and code databases and got them linked. When I
Set qs = db.OpenQueryDef("qryAppend Billed_Fees Snapshot")
qs.Parameters("FisYear") = FisYear
qs.Execute
qs.Close
How do I re-write this? There are dozens of them in the whole project. I
know it might use CreateQueryDef but is there anything else besides
replacing that?
Is there a good location somewhere with a listing of all the old syntax
and how to replace it? I'm sure this is just the beginning!
Is there any benefit to activating the DAO 2.5/3.51 compatibility Library?
Thanks!
Jackie
Albert D. Kallal
2008-02-11 08:59:47 UTC
Permalink
Post by JGawlik
Set qs = db.OpenQueryDef("qryAppend Billed_Fees Snapshot")
qs.Parameters("FisYear") = FisYear
qs.Execute
qs.Close
Also, are you sure the above code is correct?

it should read:

set qs = db.QueryDefs("qryAppend Billed_Fees Snapshot")

Did this code compile in a97 before you converted?
(as a another hint, don't try and convert something with compile
errors...make sure it compiles BEFORE you do the conversion from a97 to
a2003.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
***@msn.com
Loading...