Solved

Access97 Pass-through-Query

Posted on 2012-03-13
9
436 Views
Last Modified: 2012-03-13
I wish to use a pass-through-query in Access97 to speed up retrieving a recordset from an SQL server.

I can setup the parameters for the ODBC Connection String by opening up Properties for the pass-through-query in Access97.

Question is, how do I open the pass-through-query and programatically supply the ODBC Connection String needed to connect to the SQL server?

High points for a speedy answer!
0
Comment
Question by:SOTA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 37716401
Public Function GetQueryLinks()

On Error GoTo Err_GetQueryLinks

    Dim qdf As DAO.QueryDef
    
    For Each qdf In CurrentDb.QueryDefs
        If qdf.Connect <> "" Then
            Debug.Print qdf.Connect
        End If
    Next
    
Exit_GetQueryLinks:
    Set qdf = Nothing
    Exit Function

Err_GetQueryLinks:
    MsgBox Err.Number & " (" & Err.Description & ") in procedure GetQueryLinks of Module basTableLinks"
    Resume Exit_GetQueryLinks

End Function

Open in new window

This public function will retrieve the connection string for your pass-through queries.  A simple modification to then change/update the connection string.

qdf.Connect = "the new connection string"
qdf.RefreshLink

OM Gang
0
 

Author Comment

by:SOTA
ID: 37717005
Thanks OM Gang.
I have Access97 and the command qdf.RefreshLink is not valid.
Any thoughts?
Thanks!
0
 
LVL 28

Expert Comment

by:omgang
ID: 37717049
Try qdf.Refresh
Let me know if it still doesn't work.
OM Gang
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:SOTA
ID: 37717077
There is no QueryDef.Refresh

however,

QueryDefs.Refresh is valid.

:)
0
 
LVL 28

Expert Comment

by:omgang
ID: 37717094
Does CurrentDb.QueryDefs.Refresh successfully update the connection string for the pass-through query?
OM Gang
0
 

Author Comment

by:SOTA
ID: 37717170
Yes!! That's it!!

Perfect...thanks!!

Cheers,
Russ :)
0
 

Author Closing Comment

by:SOTA
ID: 37717171
Awesome!!!!!
0
 
LVL 28

Expert Comment

by:omgang
ID: 37717173
I tried it in Access 2007 and it works - the pass-through connection string is updated.
OM Gang
0
 
LVL 28

Expert Comment

by:omgang
ID: 37717184
You're welcome.
OM Gang
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question