Can not get my code to save muti selection

JenNorthwood

Registered User.
Local time
Today, 11:17
Joined
Apr 17, 2003
Messages
24
Hi There,

I have been trying to get this form to work for a while now. I have Three list boxes.

LstFrom = Employee's
LstTo = Employee's that are selected are to go here
TrainingCompleted = Training Courses Offered
_________
Combo Box
CourseLength = Length of the training courses
___________
Text Boxes
DateTrainingComp = Date of Training Course
txtID = Saves the employee ID that are selected
___________
Command Button
CmdUpdate = Code to try and save all the infomation into my tbltraining Completed.
______________
I have tried saving the data to a temp table, to a test qry, but I can't get the code to save the multi selection of employee's.

I can get it to select the yes/no from the employee table and the training table separately, but can fingure out how to save it into one table.

Please Help.

I have attached a sample of what I am doing. Right now it only puts the check marks in the employee selected in the employee table.

Thank you,
Jennifer
 

Attachments

To be honest, I'm not clear on what you are wanting to do.

Are you wanting to move all selected items in a listbox and make as many records in a table with those employees details?

If so, use DAO or ADO to do it by looping through the listbox's ItemsSelected property.
 
This is a form that keeps track of employees training. You pick the course say "To stop a Theif" Video, then pick the course lenght, say 30 min, then enter the date. Now you would choose the people that took the course, say Clive Brown, Jody Hall and Kelly Hodgson took the course.

Then I want it to say the employee's ID # and the other fields into the tblEmployeeTraining. I just can not figure out how to save the changes.

Jen
 
Rather than doing this with list boxes (which requires DAO or ADO code to save the records) you can use a subform. To save yourself some data entry, you can use an unbound field on the mainform to hold the training date. Then in the BeforeInsert event of the subform, you can copy the date from the mainform -

Me.TrainingDt = Parent.txtTrainingDt
 
Hi there again,

I have changed my form and used a subform, but I can't figure out how to still link the multi selection employees to the subform.

Please help.

Thanks,
Jennifer
 

Attachments

List boxes look nice and if you are comfortable with VBA, you can make them function nicely. However, subforms don't require any coding. Use a main form based on courses and a subform based on the relation table. Search the archives here for a many-to-many sample database that I posted earlier this year. It will contain the type of form that you need. The example is one of customers booking venues. The example contains 2 main forms. One that looks at the data from the customer's view and the second looks at the data from the venue's view. This is EXACTLY the same problem you need to solve.
 

Users who are viewing this thread

Back
Top Bottom