Connect to second sql database tables?

J

janetb

I have an odbc connection to an sql database backend. Everything's working
fine. But, just for a small section of code, is it possible to modify the
code below and connect to another sql database in another city for which I
have an account and password?

Dim mySql as string
mySql="select email, name from dbo_table where eid=" & forms!myForm!eid

Set db = CurrentDb() 'Probably need to change it here.....
Set rs = db.OpenRecordset(mySql, dbOpenDynaset, dbSeeChanges)
Do While Not rs.EOF
strMsg = "This is a final reminder blah....." & _
vbCrLf & Trim(rs("name"))
DoCmd.SendObject acSendNoObject, , , strTo, strCC, , strSubject,
strMsg, False
rs.MoveNext
rs.Close
Loop

DoCmd.Close
 

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