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

User defined type not defined

Status
Not open for further replies.

Sillygirl

Programmer
May 3, 2002
80
US
I donot understand this error message I'm simply calling a procedure and it blowing up when it tries to enter the procedure. Can someone help?? I'm getting user defined type not defined:

Here is the calling procedure:
Private Sub
'Maximize the windows
Me.WindowState = 2


If enter = True Then

CheckSerial <-----------------this is what I'm calling

enter = False
Delay = 0

End If

lblPart_code.Visible = True
txtpart.Text = ""
txtpart.Visible = True
End sub


THEN:::::

Called Procedure::::
Private Sub CheckSerial() <--------


Dim dtSerial As Table
Dim dtid As Table

Set dbase2 = OpenDatabase("C:\tagging\Tag.MDB")
Set mssdb = OpenDatabase("C:\tagging\MSS.MDB")

Set dtSerial = mssdb.OpenTable("Serial")
Set dtid = dbase2.OpenTable("idcode")

dtSerial.MoveFirst
dtid.MoveFirst

[banghead]
 
Try Changing the Below:

Called Procedure::::
Private Sub CheckSerial() <--------

TO:

Called Procedure::::
Public Sub CheckSerial() <--------

--Yeagly21
 
Thanks Yeagly, however I tried that and it didn't work. What references do I need to be pointing to if I am referencing an Access 2000 database?
 
From the code provided you will need to reference Microsoft DAO 3.6 Object Library
 
Try changing Table to TableDef.

[tt]Dim dtSerial As TableDef
Dim dtid As TableDef[/tt]
 
Silly -

I don't think the movefirst call will work when looking at a Tabledef. What you might want to do is look at using recordsets. Below is the CheckSerial snippet in recordsets.

Private Sub CheckSerial()

Dim rstSerial As DAO.Recordset
Dim rstID As DAO.Recordset

Set dbase2 = OpenDatabase("C:\tagging\Tag.MDB")
Set mssdb = OpenDatabase("C:\tagging\MSS.MDB")

Set rstSerial = dbase2.OpenRecordset("SELECT * FROM Serial")
Set rstID = mssdb.OpenRecordset("SELECT * FROM idcode")

rstSerial.MoveFirst
rstID.MoveFirst

End Sub


Hopefully that will help.

-Yeagly21
"Look Lois, the two symbols of the Republican Party: an elephant, and a big fat white guy who is threatened by change." -Peter Griffin
 
>From the code provided you will need to reference Microsoft DAO 3.6 Object Library

Actually, given the mix in the presented code, you probably want the Microsoft DAO 2.1/3.51 Compatibility library. And then change the

Dim dtSerial As Table
Dim dtid As Table

to

Dim dtSerial As Recordset
Dim dtid As Recordset

And that should provide the fastest/least-change fix. Of course, what you really want to do is update all the code to work with DAO 3.6, in which case (since I'm assuming you've picked up some of this code from an old example somewhere) Microsoft used to have a page highlighting the differences ... in fact ... hang on ... <fx:tappety tappety> ... yes, here we are:
 
Wow... it's been so long since I've used any of that stuff...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top