ADO/Access Store data help

StealthRT
04-16-2004, 07:28 PM
Hey all i need some help trying to store some data in my access table.
here are some pics of what my form looks like

http://www.cfapgp.com/form1.jpg

and the second after picking some things...
http://www.cfapgp.com/form2.jpg

Now there will be some 80-90 employees that will need to be saved when the user pushes the save button. After he has chosen the times for each person, he will save it.

The problem i am running into is that it wont save more than one record since i only know how to save it by the persons name.

the code i have to populate the boxes for there names is:

Sub PopulateNames()
Dim rst As ADODB.Recordset
Dim x

Open_Database
Set rst = New ADODB.Recordset
rst.Open "SELECT ID,FullName,STMon,STMonAP,ETMon,ETMonAP,EmpNotes FROM EmpSchedule", conn, adOpenDynamic, adLockOptimistic
While Not rst.EOF
txtNames.Text = rst!FullName
rst.MoveNext
txtNames2.Text = rst!FullName
lblNotes2.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
txtNames3.Text = rst!FullName
lblNotes3.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
txtNames4.Text = rst!FullName
lblNotes4.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
txtNames5.Text = rst!FullName
lblNotes5.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
txtNames6.Text = rst!FullName
lblNotes6.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
txtNames7.Text = rst!FullName
lblNotes7.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
txtNames8.Text = rst!FullName
lblNotes8.Caption = "Monday's Avalibility: " & rst!STMon & " " & rst!STMonAP & " - " & rst!ETMon & " " & rst!ETMonAP & " Notes: " & rst!EmpNotes & ""
rst.MoveNext
Wend
rst.Close
Set rst = Nothing
End Sub


and this is the code that i have right now to save all this when the user is finished:

Private Sub Command1_Click()
Dim strSQL As String
Dim rst As ADODB.Recordset

'If MsgBox("Update Employee?", vbYesNo + vbQuestion, "Update Employee?") = vbYes Then
Set rst = New ADODB.Recordset
strSQL = "SELECT * FROM EmpSchedule WHERE FullName = '" & (txtNames2.Text) & "'"
rst.Open strSQL, conn, adOpenDynamic, adLockOptimistic
rst!SchStart = cboStartTimeMonday
rst!SchStartAP = cboStartAMPMMonday
rst!SchEnd = cboEndTimeMonday
rst!SchEndAP = cboEndAMPMMonday
rst.Update
rst.MoveNext
rst.Close
Set rst = Nothing
MsgBox "done", vbInformation
End Sub


All the people in the database have the same fields that need to be added too. (SchStart,SchStartAP,SchEnd,SchEndAP) all i need it to do is see whos name is next, add the information and then move on to the next person.

Any help would be great!,
David :confused:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum