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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL SELECT syntax for external database with password

Status
Not open for further replies.

brimile

Technical User
Oct 2, 2003
5
US
I've seen a lot of forums dealing with similar subjects but I haven't seen one that answers this question.

I have an .mde front end with more than one password protected backend. I want to dynamically call a SQL query on any database I select on a form on the front end.

Example:

strSQL = "SELECT * FROM Instruments IN '" & dbBackend & "'"



This SQL works great for a backend .mdb without a password, but how can I make it work for a .mdb with a password?

 
You will need to set up the connection string to include the password

dim strCon as connection

Select case dbBackEnd
Case x
strConn = "Connection1"
Case y
strConn = "Connection2"
case else
etc etc
end select

set recset = strConn.execute(strSQL)

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top