|
-
Feb 13th, 2006, 12:27 PM
#1
Thread Starter
Junior Member
[RESOLVED] how to read SQL statement from my MDB?
hi, all!
I have for example:
Access DB without any password - DB1.MDB
my Table - Table1
my Query - Query1 = SELECT Table1.* FROM Table1;
how can I read this string with SQL statement from my VB6-Project?
thanks a lot in advance
kind regards,
Baloo.
Last edited by Baloo; Feb 13th, 2006 at 12:46 PM.
-
Feb 13th, 2006, 01:11 PM
#2
Re: how to read SQL statement from my MDB?
Create a QueryDef object and open your "Query1" object. Set a reference to Access in your project and you will find the QueryDefs collection in the Object Browser.
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 
-
Feb 14th, 2006, 05:27 AM
#3
Thread Starter
Junior Member
Re: how to read SQL statement from my MDB?
RobDog888, thanks a lot!
But could you be so kind to show me a small code-example?
kind regards,
Baloo.
-
Feb 14th, 2006, 05:54 AM
#4
Re: how to read SQL statement from my MDB?
 Originally Posted by Baloo
RobDog888, thanks a lot!
But could you be so kind to show me a small code-example?
kind regards,
Baloo.
IF you would have done a little bit search in the Forum you would have neded up with lots of samples. Take a look here
http://www.vbforums.com/search.php?searchid=634483
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Feb 14th, 2006, 10:09 AM
#5
Re: how to read SQL statement from my MDB?
VB Code:
Private Sub ReadQuery()
Dim qry As QueryDef
Set qry = Application.CurrentDb.QueryDefs("Query2")
MsgBox qry.SQL
qry.Close
End Sub
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 
-
Feb 15th, 2006, 01:52 AM
#6
Re: how to read SQL statement from my MDB?
Or to shorten the code down
VB Code:
MsgBox CurrentDb.QueryDefs("Query1").SQL
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Feb 16th, 2006, 07:16 AM
#7
Thread Starter
Junior Member
Re: how to read SQL statement from my MDB?
hi all!
Its worked
thanks to everyone for your attention
kind regards,
Baloo.
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
|