user-defined type not defined - and I AM getting a pointer ?!?!

B

Bob

running access 2k

when my code gets compiled, access complains "user-defined type not
defined" and points to the following line of code:

Dim dbCurr As Database, dbLink As Database

I am at a complete loss as to why access thinks that "database" is a
user defined type????

ne ideas?

tia - Bob
 
L

Larry Linson

Almost certainly, it is because the Reference to the DAO library is no
longer set by default in Access 2000 and 2002. Open any module in design
view, on the menu, Tools | References, check DAO 3.6 Library, and then for
each DAO object in your database, qualify the reference, as:

Dim rsABC as DAO.Recordset

If you don't also use ADO, then as a safety measure, you might want to move
the DAO Reference above the ADO Reference in the list of References.

Larry Linson
Microsoft Access MVP
 
B

Bob

thanks to both Paul & Larry;

the problem was easily rectified - I forgot about that little detail !
:)

tx again - Bob
 
H

Hafeez Esmail

Hi Paul

For some reason the "References" command under the Tools
menu is grayed out for me. How do I create a reference to
DAO?
I've posted my code FYI

Hafeez Esmail

Dim dbs As DAO.Database
Dim rstrec As DAO.Recordset
Dim rstname As DAO.Recordset
Dim strLastName As String

Set dbs = CurrentDb()
Set rstname = dbs.OpenRecordset("TblFHStaffList")
Set rstrec = dbs.OpenRecordset("QryPredef120")
If rstname.BOF = False And rstname.EOF = False Then
rstname.MoveFirst
Do While rstname.EOF = False
Set strLastName = rstname!Last_Name
If rstrec.BOF = False And rstrec.EOF = False Then
rstrec.MoveFirst
Do While rstrec.EOF = False
Where rstrec!Last_Name = strLastName
rstrec.MoveNext
Loop
DoCmd.Save acReport, "RptPredef" & strLastName
End If
rst.MoveNext
Loop
rstname.Close
Set rstname = Nothing
rstrec.Close
Set rstrec = Nothing
dbs.Close
Set dbs = Nothing
 
P

Paul Overway

What version of Access? What version is your file format? Is the database
secured?
 
H

Hafeez Esmail

Access version 2002, file is version 2000. The problem
was that I wasn't in design mode.

Now that that's been taken care of, I'm getting an error
in the following line...

DoCmd.Save acDefault, "Predef120" & strLastName

Is there a way I can save the results as a report (or
table) with a different name?

Thanks
Hafeez Esmail


Dim dbs As DAO.Database
Dim rstrec As DAO.Recordset
Dim rstname As DAO.Recordset
Dim strLastName As String

Set dbs = CurrentDb()
Set rstname = dbs.OpenRecordset("TblFHStaffList")
Set rstrec = dbs.OpenRecordset("TblPredef120",
dbOpenSnapshot)
If rstname.BOF = False And rstname.EOF = False Then
rstname.MoveFirst
Do While rstname.EOF = False
strLastName = rstname!Last_Name
If rstrec.BOF = False And rstrec.EOF = False Then
rstrec.MoveFirst
Do While rstrec.EOF = False And rstrec!
Last_Name = strLastName
rstrec.MoveNext
Loop
DoCmd.Save acDefault, "Predef120" & strLastName
End If
rst.MoveNext
Loop
End If
rstname.Close
Set rstname = Nothing
rstrec.Close
Set rstrec = Nothing
dbs.Close
Set dbs = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top