I been looking at this for a couple of hours and can’t figure it out. The program gives me the results I’m look for, however it gives it to me multiple times. If I check one ck boxes I get the information in the groups I expect except it copies it 27 times. If I have both ck boxes checked the first boxes results, I get twice and the second,I get 27 times. Any Ideas. Thanks
Code:
Option Compare Database
Option Explicit
Private Sub cmdEnter_Click()
Dim wtb As Integer
Dim r As Integer
Dim sr As Integer
Dim x As Integer
Dim Y As Integer
Dim w As Integer
Dim dh As Integer
Dim lo As Integer
Dim jt As String
wtb = Format(Me.CompleteDate(), "ww") - Format(Me.StartDate(), "ww")
Me.WeeksToBuild = wtb
x = Format(Me.CompleteDate(), "ww")
w = Format(Me.StartDate(), "ww")
dh = Me.txtDesign / wtb
lo = Me.txtLayout / wtb
Y = wtb + w
Dim ctl As Control
Dim i As Integer
For i = 1 To 9
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then
If ctl.Value = True Then
jt = ctl.Controls(0).Caption
End If
End If
For x = w To Y
If x < Y Then
If jt = "Design" Then
Forms.frmMain.frmsubMain.Form.WkNumber = x
Forms.frmMain.frmsubMain.Form.JobType = jt
Forms.frmMain.frmsubMain.Form.ToolNum = Me.ToolNum
Forms.frmMain.frmsubMain.Form.Year = Me.Year
Forms.frmMain.frmsubMain.Form.JobHr = dh
Else
If jt = "Layout" Then
Forms.frmMain.frmsubMain.Form.WkNumber = x
Forms.frmMain.frmsubMain.Form.JobType = jt
Forms.frmMain.frmsubMain.Form.ToolNum = Me.ToolNum
Forms.frmMain.frmsubMain.Form.Year = Me.Year
Forms.frmMain.frmsubMain.Form.JobHr = lo
End If
End If
End If
Me.Refresh
Forms.frmMain.frmsubMain.Form.Recordset.AddNew
Next x
Next
Exit For
Next i
End Sub