compile 97 > 2003

  • Thread starter Thread starter R.Kisoenpersad
  • Start date Start date
R

R.Kisoenpersad

hi I'm starting to convert 97 to 2003 but getting compile error


code:-----------------------------------------------------------------------
-------
Private Sub ViewGroup_AfterUpdate()

Dim r As Recordset
Dim S As String

Set r = CurrentDb.OpenRecordset("LCL_Config")
r.Edit
r![ViewGroup] = Me![ViewGroup]
r.update
r.Close

S = "Select distinctrow [LCL_Weergave].[Weergave] from
[LCL_Weergave] where [LCL_Weergave].[group] = '" & Me![ViewGroup] & "'"
Me![Weergave].RowSource = S
Me![Weergave].Value = "Please select a view..."
Me.Requery

end Sub
----------------------------------------------------------------------------
--
when compiling this code it give an error on r.edit

I now that the recordset should be dim r as dao.recordset
but what else is wrong than.

please help me out
Kisoen
 
In A97 a DAO reference is added for you.
In A2003, Access creates a ADO reference, you need to add the DAO reference
manually.
Probably a good idea to remove ADO reference too; or prefix all your DAO
declarations
 
Actually, unlike Access 2000 and 2002, Access 2003 includes a DAO reference
automatically. Problem is, it's lower in the priority sequence than the ADO
reference, so a declaration like

Dim r As Recordset

means r will be an ADO Recordset.

Either remove the ADO reference, or be explicit in your declaration:

Dim r As DAO.Recordset

(to be positive you're getting an ADO recordset, use Dim r As
ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
 
Graeme and Douglas have given you the solution for your question
(disambiguation of ADO and DAO recordsets). You may also benefit from this
article that addresses several facets of converting from A97 to later
versions, including setup issues, conversion issues, and usability issues:
http://allenbrowne.com/ser-48.html
 
Back
Top