Dim DB Problem (1 Viewer)

aussieolie

Australian
Local time
Today, 06:44
Joined
Apr 3, 2002
Messages
47
***URGENT*** DIM DB Problem

Can anybody tell me what to do about DIM DB:
This is the code that will not run:
---CODE---
Private Sub CustomerOrderNum_AfterUpdate()
On Error GoTo CustomerOrderNum_AfterUpdate_Err

Const NO_CURRENT_REC_ERR = 3021
Dim ds As Recordset
** Dim DB As Database***
Set DB = DBEngine(0)(0)
Dim strPO As String
---END OF CODE---
I really need to get this working, I dont understand how MS DAO affects this, any suggestions greatly appreciated.

Regards,

Olie
 

Mile-O

Back once again...
Local time
Today, 12:44
Joined
Dec 10, 2002
Messages
11,316
What version of Access are you using?

If you are using '97 this should be ok.

If you are using 2000 then you may have to play with your reference libraries. It's in VB Mode, Tools Menu, References - ensure that DAO has a higher priority than ADO libraries, I think, and then:

Dim db as DAO.Database
 

aussieolie

Australian
Local time
Today, 06:44
Joined
Apr 3, 2002
Messages
47
Thanks for your help man,
I cannot seem to find that menu in Access 2000, but I'll keep looking.

Thanks,

Olie
 

Autoeng

Why me?
Local time
Today, 07:44
Joined
Aug 13, 2002
Messages
1,302
Select any Module. You need to be in VBA. Select Tools - References.

Autoeng
 

aussieolie

Australian
Local time
Today, 06:44
Joined
Apr 3, 2002
Messages
47
OK Now it says that I cannot add a DAO reference as I have the following problem:
"Name conflicts with existing module, project, or object
library"
I did a search and found the world ADO and removed it to see if thsi helped, but still no luck,

Any suggestions anyone??

Thanks,

Olie
 

Nero

Shop smart, shop S-Mart
Local time
Today, 12:44
Joined
Jan 8, 2002
Messages
217
Make sure that there is no reference to a similar DAO library.
The one you need is DAO 3.6 Object library.
If you set it to higher priority than the ADO library then there is no need to add the DAO reference in the Dim line.
If it is set to lower priority than the ADO library then will will need to include the DAO in the Dim line.
 

Users who are viewing this thread

Top Bottom