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

Why Dim rst As Recordset gives error

Status
Not open for further replies.

Dirtbike

IS-IT--Management
Dec 9, 2002
81
US
rst As Recordset

Why User defined type not defined?????

Ok, I know I'm an idiot.

Thanks,

Scott in Charlotte, NC
 
Are you coding in Access (Module) when you get this error or are you using another program trying to create this variable. It sounds like you do not have your references set

------------------------
Paul D
[pimp] pimpin' aint easy
 
1 - Ensure you have a reference to the library you are going to use (Microsoft DAO 3.# Object Library/Microsoft ActiveX Data Objects 2.# Library)
2 - Do an explicit declaration - i e explicitly refer the relevant library (on all object declarations of objects relating to these libraries):

[tt]dim rs1 as dao.recordset
dim rs2 as adodb.recordset[/tt]

Roy-Vidar
 
You have to reference either Microsoft DAO Object library or Microsoft ActiveX Data Objects Library (for ADO).
When in VBE, menu Tools -> References ...
And feel free to strong typing to avoid ambiguity:
Dim rst As DAO.Recordset
or
Dim rst As ADODB.Recordset

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Keep in mind RoyVidar's post assumes you want to early bind. I like early bind while writing the program, and if I'm the only one using it I usually keep it that way. If I plan on giving the code to someone else to use, I recommend changing to a late bind before distribution

Dim rs1 as object
...
Set rs1 = CreateObject("ADODB.Recordset")
...

------------------------
Paul D
[pimp] pimpin' aint easy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top