SQL server login, ODBC link

amigos

Active Member
Joined
Sep 23, 2003
Messages
407
I got database in which most of tables are linked using ODBC liks with SQL Server. Every time I open DB and I want to run any query or display table I have to login to server. Is there any way to do this with code so I can automate this and log on using VBA every time I open DB?

thanx for any help

Amigos
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Are you aware that you can specify your SQL Server UserID and Password in the Pass-Through Query's/Linked Table's Connection String? (No VBA required):

Code:
ODBC;DSN=Your_DSN;UID=Your_UserName;
PWD=Your_Password;MODE=Your_Mode;DBALIAS=Your_DB_Alias;

Not sure if this is what you're needing or not.
 
Upvote 0
thanks for response Dugantrain,

actually I just relinked all tables, but this time I ticked "Save Password" option and it works.

I tried to do what you told me but linked tables are closed for edition, so where do I use this connection string you gave me?

Thanks again
 
Upvote 0
To specify the Connection String, open the Linked Table in Design View (it is here that you will get the 'Can't Be Edited' message). Go to the table's Properties and the first line, Description, is where you will specify this String
 
Upvote 0
yes, I know
that's what I tried to do but after I change that (I go to properties and simply edit that string in Description field) and hit enter it changes to previous string anyway.

?
 
Upvote 0

Forum statistics

Threads
1,221,567
Messages
6,160,541
Members
451,655
Latest member
rugubara

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top