Using Insert query in Module

saleem

Registered User.
Local time
Today, 13:46
Joined
Dec 31, 2001
Messages
20
I m trying to insert record in table via following code on click event

Private Sub Command8_Click()
Dim conn As ADODB.Connection


Set conn = CurrentProject.Connection

conn.Execute "INSERT INTO master VALUES ( & forms!m!Text2& ", " & forms!m!text2& );"

when i give values here directly the code works...but when i want it to pick values from form..it doesnt..any idea..where i m wrong...

saleem
 
conn.Execute "INSERT INTO master (Field1, Field2) VALUES ('" & Me![Text1] & "', '" & Me![Text3] & "' );"

Replace the field names with the ones in your table and on your form.
 
got it....thanks
 

Users who are viewing this thread

Back
Top Bottom