[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.
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.
Re: how to read SQL statement from my MDB?
RobDog888, thanks a lot! :thumb:
But could you be so kind to show me a small code-example?
kind regards,
Baloo.
Re: how to read SQL statement from my MDB?
Quote:
Originally Posted by Baloo
RobDog888, thanks a lot! :thumb:
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
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
:)
Re: how to read SQL statement from my MDB?
Or to shorten the code down
VB Code:
MsgBox CurrentDb.QueryDefs("Query1").SQL
Re: how to read SQL statement from my MDB?
hi all!
Its worked:)
thanks to everyone for your attention :thumb:
kind regards,
Baloo.