My database needs to keep track of week numbers and at the change of the year start at wk 1 again. Some of the jobs tracked can run for several weeks. So data can look like this.
WK 51 06
WK 52 06
WK 53 06
WK 01 07
WK 02 07
I used DatePart() to extract the weeks and year but for the life of I can not figure the formula that will work and I'm sure it's pretty simple. Any help will be appreciated. Thanks
WK 51 06
WK 52 06
WK 53 06
WK 01 07
WK 02 07
I used DatePart() to extract the weeks and year but for the life of I can not figure the formula that will work and I'm sure it's pretty simple. Any help will be appreciated. Thanks
Code:
Option Compare Database
Option Explicit
Private Sub cmdEnter_Click()
Dim wtb As Integer
Dim x As Integer
Dim Y As Integer
Dim w As Integer
Dim dh As Integer
Dim lohr As Integer
Dim CNCphr As Integer
Dim Layout As String
Dim Design As String
Dim CNCProg As String
Dim YR As Integer
wtb = DateDiff("ww", Me.StartDate, Me.CompleteDate)
Me.WeeksToBuild = wtb
x = DatePart("ww", Me.CompleteDate)
w = DatePart("ww", Me.StartDate)
dh = Me.txtDesign / wtb
lohr = Me.txtLayout / wtb
CNCphr = Me.txtCNCProg / wtb
Y = wtb + w
YR = DatePart("YYYY", Me.StartDate)
If Me.ck1.Value Then
Design = Me.Designlbl.Caption
End If
For x = w To Y
If x < Y Then
If Design = "Design" Then
Forms.frmMain.frmsubMain.Form.WkNumber = x
Forms.frmMain.frmsubMain.Form.JobType = Design
Forms.frmMain.frmsubMain.Form.ToolNum = Me.ToolNum
Forms.frmMain.frmsubMain.Form.Year = Me.Year
Forms.frmMain.frmsubMain.Form.JobHr = dh
End If
Me.Refresh
Forms.frmMain.frmsubMain.Form.Recordset.AddNew
End If
Next x
End Sub