Private Sub Contacts()
Dim sSQL As String
Dim strContacts As String
Set cnContacts = New ADODB.Connection 'we've declared it as a ADODB connection lets set it.
cnContacts.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= C:\New Folder\Quote1.mdb" 'this is the connection string explained in the notes section.
cnContacts.Open
Set rsContacts = New ADODB.Recordset 'as we did with the connection
strContacts = frmCustomers.txtAddress1.Text
'Below is the SQL Statement to gather the correct information
'from tblContact and tblCustomer.
sSQL = "SELECT "
sSQL = sSQL & "Contact1 "
sSQL = sSQL & "FROM "
sSQL = sSQL & "tblContact "
sSQL = sSQL & "WHERE Address "
sSQL = sSQL & "= '" & strContacts & "' "
rsContacts.Open sSQL, cnContacts, adOpenDynamic, adLockOptimistic, adCmdText
Set DataGrid1.DataSource = rsContacts.DataSource
End Sub