Conversion to Access Project- currentdb

B

blinton25

Hi,

How is everyone today?

I am in the process of converting an Access database to an
Access Project. The data sits in a SQL server database
while reports/queries/forms remain in Access.

I had:

Option Compare Database
Option Explicit
Public Sub Command20_Click()
Dim db As Database

Set db = CurrentDb()

but changed this to:

Option Compare Database
Option Explicit
Public Sub Command20_Click()

Dim db As ADODB.Connection

Set db = CurrentProject.Connection


which works ok.

Now later in the code I have:


Private Sub Command1_Click()

Dim db As ADODB.Connection


which gives me the following error:

'Compile error: User-defined type not defined'

I am not sure why this is happening, any suggestions?
 
D

Douglas J. Steele

The only thing I can think of is to try doing a Compile on your project to
see whether there's some other error that's causing Access to behave this
way. With any code module open, Compile is the top option on the Debug menu.

You might also check that you haven't got a problem with your references.
Again, with any code module open, select Tools | References from the menu
bar and examine all of the selected references, looking for any that have
"MISSING:" in front of them.
 

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