M
Marcelino Benitez via AccessMonster.com
Good morning guys. This is my issue. I have a custom counter that be have
this setting
A6001-01 means "Company letter" "year" "Julian Date"- "counter #"
Ok my problem is if I start a day with company letter D6001-01 is good. Ok,
If the next one is company letter "A" is suposse to be A6001-01 because is
the first work order number for this date on this company but the problem is
display A6001-02. This one is my routine please let me know what I'm doing
wrong.
Dim count As Variant
Dim compdate As Variant
Dim JDate As Integer
Dim Ydate As Integer '
Dim t As Variant 'Counter variable
Me.Undo
Form.Requery
DoCmd.GoToRecord , , acLast 'Send the page to the last record
compdate = Text31
'MsgBox Text31
DoCmd.GoToRecord , , acNewRec
JDate = Format(Date, "y")
Ydate = Format(Date, "yy")
If JDate < 10 Then
tdate = Ydate & "0" & "0" & JDate & "-" & "01"
End If
If JDate >= 10 Then
tdate = Ydate & "0" & "0" & JDate & "-" & "01"
End If
If JDate > 99 Then
tdate = Ydate & JDate & "-" & "01"
End If
'MsgBox [tdate]
If compdate > tdate Or compdate = tdate Then
t = Format(compdate, "!&&")
If t < 99 Then
t = t + 1
t = Format(t, "00")
End If
If JDate < 10 Then
WONum = Ydate & "0" & "0" & JDate & "-" & t
End If
If JDate >= 10 Then
WONum = Ydate & "0" & JDate & "-" & t
End If
If JDate > 99 Then
WONum = Ydate & JDate & "-" & t
End If
Else
WONum = tdate
End If
Thanks in advance.
Marcelino
this setting
A6001-01 means "Company letter" "year" "Julian Date"- "counter #"
Ok my problem is if I start a day with company letter D6001-01 is good. Ok,
If the next one is company letter "A" is suposse to be A6001-01 because is
the first work order number for this date on this company but the problem is
display A6001-02. This one is my routine please let me know what I'm doing
wrong.
Dim count As Variant
Dim compdate As Variant
Dim JDate As Integer
Dim Ydate As Integer '
Dim t As Variant 'Counter variable
Me.Undo
Form.Requery
DoCmd.GoToRecord , , acLast 'Send the page to the last record
compdate = Text31
'MsgBox Text31
DoCmd.GoToRecord , , acNewRec
JDate = Format(Date, "y")
Ydate = Format(Date, "yy")
If JDate < 10 Then
tdate = Ydate & "0" & "0" & JDate & "-" & "01"
End If
If JDate >= 10 Then
tdate = Ydate & "0" & "0" & JDate & "-" & "01"
End If
If JDate > 99 Then
tdate = Ydate & JDate & "-" & "01"
End If
'MsgBox [tdate]
If compdate > tdate Or compdate = tdate Then
t = Format(compdate, "!&&")
If t < 99 Then
t = t + 1
t = Format(t, "00")
End If
If JDate < 10 Then
WONum = Ydate & "0" & "0" & JDate & "-" & t
End If
If JDate >= 10 Then
WONum = Ydate & "0" & JDate & "-" & t
End If
If JDate > 99 Then
WONum = Ydate & JDate & "-" & t
End If
Else
WONum = tdate
End If
Thanks in advance.
Marcelino