I am using a Recordset named "rs" and displayed the value of rs in a datagrid named "datagrid1" and the values of rs is as follows:
I can't attach file here and it show server error and so please take a look into the screenshot of the file here http://tinypic.com/r/dbsjdf/6 and in that image you can see a button named "save". When i click save button then all the values in that datagrid should be saved in the table named "studentexam" in 2007 Access in a "single click" of save button. I have tried the following code but it saves only the first value for many times (more than 100 times a same value and no primary key set)
could anyone give me a solution for this and if you need more info ask me...
rs.Open "SELECT subjectcode.Year1, subjectcode.Year2, subjectcode.Subjectcode, subjectcode.Subjectname, subjectcode.Theory_Practical, q.Fee FROM subjectcode INNER JOIN ( SELECT fees.Year1, fees.Year2, 'Theory' As FeeType, fees.Theoryfee As Fee FROM fees UNION ALL SELECT fees.Year1, fees.Year2, 'Practical' As FeeType, fees.Practicalfee As Fee FROM fees) AS q ON (subjectcode.Theory_Practical = q.FeeType) AND (subjectcode.Year2 = q.Year2) AND (subjectcode.Year1 = q.Year1)", con, 1, 3
I can't attach file here and it show server error and so please take a look into the screenshot of the file here http://tinypic.com/r/dbsjdf/6 and in that image you can see a button named "save". When i click save button then all the values in that datagrid should be saved in the table named "studentexam" in 2007 Access in a "single click" of save button. I have tried the following code but it saves only the first value for many times (more than 100 times a same value and no primary key set)
Do Until rs.EOF
rs3.Open "select * from studentexam", con, 1, 3
rs3.AddNew
rs3!AdmnNo = admno.Caption
rs3!semester = semester.Caption
rs3!Subjectcode = rs.Fields("Subjectcode")
rs3!Regular_Arrear = "Regular"
rs3!Fee = rs.Fields("Fee")
rs3.Update
MsgBox "Record Saved!"
rs3.MoveNext
rs3.Close
Loop
could anyone give me a solution for this and if you need more info ask me...