You need to post more information than this.
An example of a SELECT query would be something like:
Code:
Dim sSQL As String
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
sSQL = "SELECT * FROM MyTable"
Set cn = New ADODB.Connection
cn.open "DSN=MyDSNName" 'from your ODBC setup
Set rs = New ADODB.Recordset
rs.Open sSQL, cn, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
'do something iterative with the data...?
rs.MoveNext
Loop
or
Code:
sSQL = "INSERT INTO MyTable(Username, LastName, FirstName) VALUES('mmcdonal', 'Mike', 'McDonald')"
...
rs.Open sSQL, cn, adOpenDynamic, adLockOptimistic 'this line does the insert
cn.Close
Then if you want to use variables...
Code:
Dim sUsername As String
sUsername = Me.Username 'referring to a form control
sSQL = "SELECT * FROM MyTable WHERE Username = '" & sUsername & "'"
...
rs,Open sSQL, cn, ...
Did any of that help?