Data type not defined?

Balr14

Registered User.
Local time
Today, 17:59
Joined
Oct 30, 2008
Messages
34
I'm trying to run some code from an older version of Access and I get an error that says "User type is undefined" on my "Dim VistaDB As Database" statement. It was not a user type before and I don't know what to use instead. Here's the whole little routine that's just meant to clean up some data in a table:

Public Sub FixData1()
Dim VistaDB As Database
Dim CrapData As Recordset
Set VistaDB = CurrentDb
Set CrapData = VistaDB.OpenRecordset("tblVista")
CrapData.MoveFirst
CrapData.Edit

If Mid(CrapData!mess1, 3, 1) = "/" Then
CrapData!Dept = Mid(CrapData!mess1, 1, 2)
CrapData!div = Mid(CrapData!mess1, 4, 2)
CrapData!mess1 = " "
Else
CrapData!lastName = CrapData!mess1
CrapData!mess1 = " "
End If

CrapData.Update
CrapData.Close

End Sub
 
Make sure the Microsoft DAO reference is checked in Tools/references, then disambiguate those to:

Dim VistaDB As DAO.Database
Dim CrapData As DAO.Recordset
 
Thank you, thank you! :)

I never would have found that myself.
 
I changed the code and checked DAO reference in tools/reference. Now I get "Run Time error 13 type mismatch" on the set command:

Public Sub FixData1()
Dim VistaDB As DAO.database
Dim CrapData As DAO.Recordset
Set VistaDB = CurrentDb
 
Is this just a matter of specifying DAO 3.6 instead of 3.0?
 
Sorry, I missed the earlier question. Yes, you should check the most current version, which is 3.6. I should have specified that before.
 

Users who are viewing this thread

Back
Top Bottom