RayH
Registered User.
- Local time
- Today, 04:54
- Joined
- Jun 24, 2003
- Messages
- 132
I'm trying to use :
Private Sub Form_Open(Cancel As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.openrecordset("Tablename")
etc...
to add a record before anything else happens. The table I'm trying to add a record to is not used in the form at all.
But I get an error on the 'dim db DAO.Database' line stating:
"Compile error: User-defined type not defined"
The code I'm using is based on code found in these forums.
I don't understand why I'm getting the error as it seems to work for other members. Should it be defined somewhere? I guess I'm missing something.
I'm using Access 2000.
Thanks
Private Sub Form_Open(Cancel As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.openrecordset("Tablename")
etc...
to add a record before anything else happens. The table I'm trying to add a record to is not used in the form at all.
But I get an error on the 'dim db DAO.Database' line stating:
"Compile error: User-defined type not defined"
The code I'm using is based on code found in these forums.
I don't understand why I'm getting the error as it seems to work for other members. Should it be defined somewhere? I guess I'm missing something.
I'm using Access 2000.
Thanks