Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Records from one form

Status
Not open for further replies.

smanuel

IS-IT--Management
May 15, 2000
15
CA
I have a training database here and for the fields in the table I have firstName, LastName, CourseName1, CourseName2......there are like 80 different courses courseDescription, Instructor etc. These CourseName fields are yes/no fields, so for each person the courses that they have completed are checked. <br><br>There is a data entry form and each time a training course is completed, we have to go in and enter all the information individually for each person who did the training course. What I want is to be able to go in and enter the data once but still have it recorded for all the people who took the course. sorta like entering the data and attaching it to 20 names out of 2000.<br><br>
 
One way to do this is to set up a seperate table called eg.g tblDefaults and a form which will be used to enter info in the defaults table. <br>Then on the data entry screen for each person you will create a button or a check box called e.g. Fill up defaults.<br>On Click of this button you can write code that will fill up info from the defaults table to the current screen.<br>does it make sense?<br> <p>Sandeep Anand<br><a href=mailto:sandeep@matatechnologies.com>sandeep@matatechnologies.com</a><br><a href= Technologies</a><br>visit
 
Perhaps also using a listbox to select the names of the people who need updating, and passing the selection as criteria to an update query.<br><br>Drew
 
never thought of that, but how would you select multiple people (maybe on the dbl-click event)?
 
With the listbox multi-select set to simple, you can make it so one click selects the name, another de-selects it.<br><br>To construct the criteria string after the control is clicked...<br><br><br>Dim frm As Form, ctl As Control<br>Dim varItem As Variant<br>Dim strSQL As String<br>Dim strStudent As String<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set frm = Me<br>&nbsp;&nbsp;&nbsp;&nbsp;Set ctl = frm!lstStudents<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For Each varItem In ctl.ItemsSelected<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strSQL = strSQL & &quot;'&quot; & ctl.ItemData(varItem) & &quot;' OR [StudentName] = &quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next varItem<br><br>&nbsp;&nbsp;&nbsp;&nbsp;If Nz(strSQL, &quot;&quot;) = &quot;&quot; Then<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strStudent = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' chops off the end of the string and adds condition to beginning<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' might need cut off spaces adjusted.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strStudent = &quot;[StudentName]&quot; & Left$(strSQL, Len(strSQL) - 20)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br><br><br>HTH,<br>drew<br><br>
 
BTW, my apologies for not crediting Dev Ashish for the above code.<br><br>red faced,<br>drew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top