|
-
Jul 10th, 2006, 11:18 AM
#1
Thread Starter
Hyperactive Member
Query and VB6
Am using MsAccess as my database and VB6. I have some queries that I use with my database. Is it possible to use MsAccess queries in VB6? If yes, how do I code in order to use the queries?
-
Jul 10th, 2006, 11:21 AM
#2
Re: Query and VB6
You can use ADO and its Command Object to execute an Access query or you can use the Access Object Model or DAO, etc. There is a good ADO db tutorial in the Database forum's sticky threads at the top of its forum.
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 
-
Jul 10th, 2006, 11:38 AM
#3
Thread Starter
Hyperactive Member
Re: Query and VB6
Sorry, but I have checked the database threads and I have not seen where they explain how to use an MSAccess query. please help
-
Jul 10th, 2006, 11:51 AM
#4
Re: Query and VB6
Do you have knowledge of using ADO? If not then I suggest going over the tutorial located here - http://vbforums.com/showthread.php?t=349994
Then its just a matter of setting up a Command object passing the query name but it will return a forward only, read only recordset if you need to perform any updates on it then you will need to execute an action statment additionally.
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 
-
Jul 10th, 2006, 04:45 PM
#5
Re: Query and VB6
 Originally Posted by osemollie
Am using MsAccess as my database and VB6. I have some queries that I use with my database. Is it possible to use MsAccess queries in VB6?
In fact it's a great tool. You can build a query in Access very easily in design view, then go to SQL, copy the SQL statement and (once you've learned ADO in VB6) paste it into the VB IDE as a string. Add text box or combo box values for your Where clause and you can have a pretty complex VB query done in a few minutes.
The opposite is also a great tool. Set a breakpoint in VB to just after your SQL string is created, debug.print it, copy it and paste it into Access. Access gives you a better indication of where an error is. ("Syntax Error" in VB isn't all that helpful if you have a huge SQL statement.)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
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
|