Query a sql server directly

G

Guest

Hi, does anyone know of a way which I can query a sql server directly from
vba? i would rather do that than go down the linked tables route. Also if
it is possible for me to have the sql server login and password saved so that
I am not prompted that would be great. Security is not an issue for this as
the users do not have any knowledge of Access and are not the type to start
messing about with it.

Thanks in advance,

Stu
 
S

Stefan Hoffmann

hi Stu,
Hi, does anyone know of a way which I can query a sql server directly from
vba?
Use ADDB.Connection and ADODB.Recordset in your code.
i would rather do that than go down the linked tables route.
I always prefer this way, as it is easier to manage.
Also if
it is possible for me to have the sql server login and password saved so that
I am not prompted that would be great.
Is this the reason for you to look for alternatives?

Create a passthrough query and assign the same connect string and the
user credentials from your tables in code. Open it in code. Any other
linked table using the same connect string will no more prompt for
credentials.



mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top