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

Conversion of Access 97 to Access 2000

Status
Not open for further replies.

vpnsymech

Programmer
Mar 26, 2002
5
US
I am trying to convert Access 97 basic to Access 2000 visual basic.

The following code is returning an error on the line line that states:
Dim db As Database

The error is:
"Compile Error."
"User-defined type not defined"

Here is the actual code.

Dim db As Database <<-Here is the error in the code|||
Dim rst As Recordset


Set db = CurrentDb
Set rst = db.OpenRecordset(&quot;tbl_visitor&quot;)
Dim newID As Integer
With rst

.AddNew
newID = !visitorID
!firstname = Me.TextFirstNameV.Value
!lastname = Me.TextLastNameV.Value
!employeefirstname = Me.TextFirstNameE.Value
!employeeLastname = Me.TextLastNameE.Value
!company = Me.TextCompany.Value
!Date = Now
!reasonforvisit = Me.TextVisitPurpose.Value
!agreedToTerms = True
.Update
.Close

End With
 
In Access 97, the data objects were DAO objects. They still can be in Access 2000, but many of the ADO data objects in Access 2000 have the same name as the DAO objects. You need to explicitly define the DAO data objects and make sure there is a reference to the DAO library. Then all will be well.

Dim rs as DAO.Recordset
Dim db as DAO.Database
Dim rs as ADODB.Recordset
Dim fld as DAO.Field
etc......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top