Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dim CurDB As Database

Status
Not open for further replies.

4Wile

Programmer
Jul 16, 2001
25
US
I have a code that is;
Dim CurDB As Database
Set CurDB = CurrentDB()
I get error message "Compile Error" User defined type not defined..CurDB As Database is highlighted..

I copied the code from a working MDB form.
What happened??
 
you must be using access 2000 with out the dao references checked. Just a guess
 
What version of Access are you using, and what version did you copy the code from?

At a guess, you've copied code from Access 97 (or earlier) into an Access 2000 db. If this is correct, use the format

Dim CurDB As ADODB

You could also check your references (from any module "TOOLS|References" from the menubar) to ensure that Microsoft DAO 3.51 Object Library is checked. If not, add it to your references.

HTH

Lightning
 
I forgot to check DAO 3.51, but now it says:
"Compile Error"
"Method or data member not found"
Code is:
Do While not RS.EOF
Rs.Edit
Rs.("Selected")=False
RS.Update
Rs.MoveNext
Loop
Rs.Edit is highlighted..

 
if you declared as lighting suggested

Dim CurDB As ADODB then you have opened a ado recordset not a dao in that case you don't need to use the edit

simply saying
Rs.fields("Selected").value = False

should do it

if you go to msdn.microsoft there is a decent article on converting from dao to ado that should help you get a better understanding of the diffrences between the two
good luck
 
BrainDead

Thanks...Now everythings works!

4Wile
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top