Converting DB to Access 2003

P

P

Hello. I am converting DB from Access 2.0 to Access 2003. I need to replace
the following code:

Dim DB As Database, SourceTable As Table
Set DB = CurrentDb()
Set SourceTable = DB.OpenTable("Source Data")

With 2003 equivalent, could somebody help please ?

Thank you.
 
A

Alex White MCDBA MCSE

The conversion is not due to the different version of Access this is because
the default database system is now ADO rather than DAO, 2 ways to solve this
either add a reference in references to the dao library (the easy way)

change your code to

Dim DB As dao.Database, SourceTable As dao.Table
Set DB = CurrentDb()
Set SourceTable = DB.OpenTable("Source Data")

or use ado (the hard way)

dim SourceTable as new adodb.recordset
SourceTable.Open "Select * from [Source
Data]",currentproject.connection,adopenkeyset, ' your lock type
 
P

P

Thank you Alex, but I now have another problem. When compiling the code I
receive the message:

Compile Error: User-defined type not defined.

Under Tools/References I have 'Microsoft DAO 3.6 Object Library' selected.
Is this correct ?

P



Alex White MCDBA MCSE said:
The conversion is not due to the different version of Access this is because
the default database system is now ADO rather than DAO, 2 ways to solve this
either add a reference in references to the dao library (the easy way)

change your code to

Dim DB As dao.Database, SourceTable As dao.Table
Set DB = CurrentDb()
Set SourceTable = DB.OpenTable("Source Data")

or use ado (the hard way)

dim SourceTable as new adodb.recordset
SourceTable.Open "Select * from [Source
Data]",currentproject.connection,adopenkeyset, ' your lock type

--
Regards

Alex White MCDBA MCSE
http://www.intralan.co.uk

P said:
Hello. I am converting DB from Access 2.0 to Access 2003. I need to
replace
the following code:

Dim DB As Database, SourceTable As Table
Set DB = CurrentDb()
Set SourceTable = DB.OpenTable("Source Data")

With 2003 equivalent, could somebody help please ?

Thank you.
 
A

Alex White MCDBA MCSE

your reference is correct,

change the
dao.Database

back to just Database

my mistake sorry


--
Regards

Alex White MCDBA MCSE
http://www.intralan.co.uk

P said:
Thank you Alex, but I now have another problem. When compiling the code I
receive the message:

Compile Error: User-defined type not defined.

Under Tools/References I have 'Microsoft DAO 3.6 Object Library' selected.
Is this correct ?

P



Alex White MCDBA MCSE said:
The conversion is not due to the different version of Access this is
because
the default database system is now ADO rather than DAO, 2 ways to solve
this
either add a reference in references to the dao library (the easy way)

change your code to

Dim DB As dao.Database, SourceTable As dao.Table
Set DB = CurrentDb()
Set SourceTable = DB.OpenTable("Source Data")

or use ado (the hard way)

dim SourceTable as new adodb.recordset
SourceTable.Open "Select * from [Source
Data]",currentproject.connection,adopenkeyset, ' your lock type

--
Regards

Alex White MCDBA MCSE
http://www.intralan.co.uk

P said:
Hello. I am converting DB from Access 2.0 to Access 2003. I need to
replace
the following code:

Dim DB As Database, SourceTable As Table
Set DB = CurrentDb()
Set SourceTable = DB.OpenTable("Source Data")

With 2003 equivalent, could somebody help please ?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top