Question : INSERT INTO ACCESS DB with SQL

Hey all,

I am attempting to insert data into an access table when the form loads.  Any ideas with the code? I can execute the code when specific values are entered but when i try and place in the variables then it gets upset.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Private Sub Form_Load()
Dim strName As String
Dim strDate As String
Dim db As DAO.Database  ' current database
Dim sSQL As String      ' SQL query

Set db = DBEngine(0)(0)

strName = Text74.Value
strDate = Text70.Value

sSQL = "INSERT INTO userLog (uName, uDate) VALUES (strName, strDate) "
        db.Execute sSQL

MsgBox strName
MsgBox strDate

Answer : INSERT INTO ACCESS DB with SQL

also try

sSQL = "INSERT INTO userLog (uName, uDate) VALUES ('" + strName +"', '" + strDate + "') "
Random Solutions  
 
programming4us programming4us