|
-
Jan 6th, 2005, 06:17 AM
#1
Thread Starter
New Member
-
Jan 6th, 2005, 10:29 AM
#2
Re: Compile error in VBA for Access- User defined type not defined
Have you added a reference for ADO to your project, if not then you need to !
-
Jan 6th, 2005, 10:52 AM
#3
Thread Starter
New Member
Re: Compile error in VBA for Access- User defined type not defined
I thought that was just for Vb, I'm a bit confused between the two. Haven't done VBA before. I thought I was already connected to the database as the textboxes automatically filled up with records when I attached them to the table recordsource. So do I add an ADO object at design time and then create the connection through the Jet Engine?
-
Jan 10th, 2005, 06:18 PM
#4
Re: Compile error in VBA for Access- User defined type not defined
Since this is VBA inside an Access database you should have the reference for DAO
- Microsoft DAO x.x Object Library. If not then add it. You can explicitly
dimention your objects like so.
VB Code:
Option Compare Database
Option Explicit
Function AddPlayer()
Dim dbCurrent As DAO.Database
Dim rstPlayers As DAO.Recordset
Dim rstCards As DAO.Recordset
Dim dbMichael As DAO.Database
Set dbCurrent = DBEngine.Workspaces(0).Databases(0)
'This will create a table-type recordset.
Set rstPlayers = dbMichael.OpenRecordset("Players", "databases\Michael.mdb", DB_OPEN_DYNASET)
'These will create a dynaset-type recordset.
Set rstCards = dbMichael.OpenRecordset("Cards", "databases\Michael.mdb", DB_OPEN_DYNASET)
rstPlayers.Move 4
End Function
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|