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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic problem whit "Database" 1

Status
Not open for further replies.

Larshg

Programmer
Mar 1, 2001
187
DK
I am trying to make a unique id to a record this is done by using a seperate table that I want to lock when I read it so that nobody else can get the number and then adding on to the number in the table

The VB code for it is

Dim MyDbs As Database
Dim tblNewId As Record

Set MyDbs = "TheNameOfMyDatabase()"
Set tblNewID = MyDbs.OpenRecordset("NytID, dbDenyRead")

tblNewId = tblNewId +1

I get am error in the first sentense "Dim MyDbs As Database" the error massage is "User-defined type not defined"

I got the ideer for this code form faq700-184

 
Try:
Set MyDbs = CurrentDb()
Set tblNewID = MyDbs.OpenRecordset(NytID, dbDenyRead)
! Gord
ghubbell@total.net
 
Yes - but the error occours in the line
"Dim MyDbs As Database"

This is where the error massage is appering - I am using access2000 but are there anything i should "import"(like in java) to get the "Database"
 
Here's what you have to do:
In visual basic Tools-References: Check off MS DAO 3.6 Object Library. Close this dialog and try to compile the database. If it won't go back to tools-references and move the priority of DAO 3.6 up a click or two. Try again or until it compiles and you're on your way! Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top