Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change ODBCConnectStr for PassThrough Queries in VBA?

Status
Not open for further replies.

ordendelfai

Technical User
Nov 8, 2002
187
US
I am working on some code to change between my development and my production server with a click of a button. I have many pass through query's that must have the ODBCConnectStr changed.

The problem I am having is referencing the ODBCConnectStr property of my queries in VBA (never had to before).

I am guessing it is something like:
Code:
Dim MyQuery As QueryDef
But when I assign a query name (value) to MyQuery then try:
Code:
MyQuery.ODBCConnectStr
I get the error "Method or Data Member not found".

Thanks for you help ;-)



~Joel
As common courtesy and to help other members who might find your thread helpful in the future, please respond if the advice given resolved your issue.
 
nm, I figured it out. You have to use something like:

Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs(QryName)

Then you can reference:

qdf.connect = "Odbc Connection String"



~Joel
As common courtesy and to help other members who might find your thread helpful in the future, please respond if the advice given resolved your issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top