Hi Folks,
I have a form bound to Table1 and a subform in it bound to Table3. When I click on the SUBMIT button, I get 2 records added in Table1 and 1 record in Table3. Table3 data seems OK. In Table1 the first record created has all the data fields filled, but not the name, date and empolyeeID fields. The next record has the opposite. Name, date and employeeID are filled, but none of the data fields. The Autonumber Primary field update on each record, the the table does have 2 new records.
Being new to Access (2003) I'm lost. Here's the code:
Sorry for being so windy.
Any ideas on what I'm doing wrong?
Any help would be appreciated.
TIA
Heisenberg was probably right.
I have a form bound to Table1 and a subform in it bound to Table3. When I click on the SUBMIT button, I get 2 records added in Table1 and 1 record in Table3. Table3 data seems OK. In Table1 the first record created has all the data fields filled, but not the name, date and empolyeeID fields. The next record has the opposite. Name, date and employeeID are filled, but none of the data fields. The Autonumber Primary field update on each record, the the table does have 2 new records.
Being new to Access (2003) I'm lost. Here's the code:
Code:
Private Sub btnclmssbmt_Click()
On Error GoTo Err_btnclmssbmt_Click
'We need to paste new data for the subform (table 1)
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Table1")
rs.AddNew
rs!EmpID = Forms!Main!EmpID
rs!Name = Forms!Main!UserName
rs.Update
rs.Close
'We need to paste new data for the subform (table 3)
Set rs = CurrentDb.OpenRecordset("Table3")
rs.AddNew
rs!EmpID = Forms!Main!EmpID
rs!Date = Forms!Main!Date
rs.Update
rs.Close
'Close the form
DoCmd.Close
'Open the Employee Menu form
DoCmd.OpenForm "Emp_Menu"
Exit_btnclmssbmt_Click:
Exit Sub
Err_btnclmssbmt_Click:
MsgBox Err.Description
Resume Exit_btnclmssbmt_Click
End Sub
Any ideas on what I'm doing wrong?
Any help would be appreciated.
TIA
Heisenberg was probably right.