B
babs
I have a command button on the Main form that I click to Insert records onto
the subform to schedule the jobs for that week. See Code below:
Private Sub InsertWKSched_Click()
'START
Dim dteWeedday As Date
Dim i As Integer
Dim strSQL As String
For i = 1 To 6 '(Monday to Saturday)
dteWeekday = DateAdd("d", Me.txtdate, -i) 'increment sunday by i days
strSQL = "INSERT INTO [TimeCardMDJEFF] ([workdate],[date],[man
name],[actualRate]) VALUES (#" & Format(dteWeekday, "m-d-yyyy") & "#," & "#"
& Format(Me.Date, "m-d-yyyy") & "#,""" & Me.cboman.Column(0) & """,""" &
Me.cboman.Column(1) & """)"
DoCmd.RunSQL (strSQL)
Next i
'END
Me.datbarbTimeCardMDJEFFSubform2.Requery
End Sub
It works but when i go to add a New record on the main form
and select a NEW a name to schedule - the new name shows up in the combo box
-
BUT when I go to insert the records(clicking on command button from code
above)It inserts the 6 records but - it grabs the name from the previous
record
that I put in - not sure what code I need to add and on what Place - on combo
box, on form or on command button to insert records to make it the Most
present name selected in combo box from the main form???
Need help bad - can't figure this out????
thanks soo much,
barb
the subform to schedule the jobs for that week. See Code below:
Private Sub InsertWKSched_Click()
'START
Dim dteWeedday As Date
Dim i As Integer
Dim strSQL As String
For i = 1 To 6 '(Monday to Saturday)
dteWeekday = DateAdd("d", Me.txtdate, -i) 'increment sunday by i days
strSQL = "INSERT INTO [TimeCardMDJEFF] ([workdate],[date],[man
name],[actualRate]) VALUES (#" & Format(dteWeekday, "m-d-yyyy") & "#," & "#"
& Format(Me.Date, "m-d-yyyy") & "#,""" & Me.cboman.Column(0) & """,""" &
Me.cboman.Column(1) & """)"
DoCmd.RunSQL (strSQL)
Next i
'END
Me.datbarbTimeCardMDJEFFSubform2.Requery
End Sub
It works but when i go to add a New record on the main form
and select a NEW a name to schedule - the new name shows up in the combo box
-
BUT when I go to insert the records(clicking on command button from code
above)It inserts the 6 records but - it grabs the name from the previous
record
that I put in - not sure what code I need to add and on what Place - on combo
box, on form or on command button to insert records to make it the Most
present name selected in combo box from the main form???
Need help bad - can't figure this out????
thanks soo much,
barb