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

Connection string and SQL statement - I am new to this!

Status
Not open for further replies.

VbPanicStation

Technical User
Dec 12, 2004
22
0
0
GB
Hi,
Please help!!! I have not used ado connection strings and SQL statements before so I am really stuck.
What I am trying to do is access some tables/ query within the same ACCESS 2003/ 2000 database using VBA and then use the data to send out an 'automatic' email.

Questions:
1. How do I set up a connection string in VBA such that I can access the data in the tables within the same ACCESS database?

2. How do I write and run the SQL statements to retrieve the data?

PLEASE HELP!!
 
VPS, there are countless web sites to find this info....
Dim SQL As String, rec As New ADODB.Recordset
SQL = "SELECT txtName, txtEmail FROM tblContacts " & _
"WHERE txtDateSent Is Null"

rec.open SQL, CurrentProject.Connection, adOpenForwardOnly,adLockPessimistic

rec.Close: Set rec = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top