• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Access ADO Help

Florida Doc

Weaksauce
Joined
Sep 9, 2004
Messages
92
Hello,

Does anyone know how to access the SQL of a stored query using ADO?

The DAO way to do it is:

Dim DB As DAO.Database
Dim strSQL As String
Set DB = CurrentDB

DB.QueryDefs("Some_Query").SQL = strSQL

DB.Close

What's the ADO equivalent of this?

Thanks!
 
I've never tried feeding in the name of a query, but this might work:

Code:
Set cn = Application.CurrentProject.Connection
                    
Set cmd = New ADODB.Command
With cmd
   .ActiveConnection = cn
    .CommandText = "[Access Query Name Here]"
    .Execute
End With
                    
Set cmd = Nothing
Set cn = Nothing
 
Back
Top