megatronixs
Registered User.
- Local time
- Today, 14:24
- Joined
- Aug 17, 2012
- Messages
- 719
Hi all,
I have a form where the user would enrol people for a training. in the form there is a subform in the datasheet view with one field called "eid"
The user would put several eid nr (employee id) and then when she/he clicks on the button, it should go one by one record and add them to the enrolment table.
I have tried with the below code, but it only seems to take the last one and even with the MoveFirst did not work out. any clue where I go wrong?
Greetings.
I have a form where the user would enrol people for a training. in the form there is a subform in the datasheet view with one field called "eid"
The user would put several eid nr (employee id) and then when she/he clicks on the button, it should go one by one record and add them to the enrolment table.
I have tried with the below code, but it only seems to take the last one and even with the MoveFirst did not work out. any clue where I go wrong?
Code:
Private Sub btn_enrol_from_list_Click()
Dim event_id As String
Dim eid As String
Dim db As DAO.Database
Dim manual_list As DAO.Recordset
Set db = CurrentDb()
Set manual_list = db.OpenRecordset("tbl_manual_enrol_temp")
event_id = Me.event_id_text
eid = Me!frm_manual_enrol_temp_sub.Form![eid]
Do While Not manual_list.EOF
Debug.Print eid
'CurrentDb.Execute "INSERT INTO tbl_enrolment (event_id, participant_peoplesoft_id, date_received) Values( '" & event_id & "','" & eid & "','" & Date & "')"
manual_list.MoveNext
Loop
End Sub
Greetings.