INsert value and then copy values from table to other table

gracepinas

New member
Joined
Jan 29, 2010
Messages
2
Programming Experience
Beginner
Hi

in my access dbase tblJobRpt i have
3 primary keys

pay_ref, empcode,tdate

how can i insert values from table tblJobdtr to another table tblJobRpt where
in pay_ref is no a common field and the value is inserted from a text box..

i want to do something like this

VB.NET:
 Execute("INSERT INTO tblJobsRpt (payref) VALUES('" & PayRef & "') Select empcode,tdate,JobCode,AMin,AMout,PMin,PMout,hrsday,OTin,OTout,OT,OTin2,OTout2,sunhrs from tblJobsDTR where empcode ='" & .Item("empcode") & "'")

but i cannot process the sql statment it says missing semicolon at the end of sql statement... can you help me

thanks
 
query:
INSERT INTO tblJobsRpt
SELECT * FROM tblJobsDTR WHERE empcode = ?

vb code:
command.Parameters.AddWithValue("e", textbox1.Text)

I've called my parameter "e" to highlight that there is no relationship between it and the query. it is the order and count of parameters that matters
 
Back
Top