Dim DB Problem

aussieolie

Australian
Local time
Today, 04:26
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
 
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
 
Thanks for your help man,
I cannot seem to find that menu in Access 2000, but I'll keep looking.

Thanks,

Olie
 
Select any Module. You need to be in VBA. Select Tools - References.

Autoeng
 
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
 
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

Back
Top Bottom