62
« เมื่อ: 22 เม.ย. 62 , 09:50:34 »
ปกติเมื่อป้อนข้อมูลแต่ละวัน เลขที่บิลจะ auto running เป็น IV62-04-21-01 บิลต่อไปเป็น 02 03 ...ถ้าป้อนในวันเดียวกัน ครับ แต่ถ้าวันนี้ต้องการกลับไปป้อนเอกสารย้อนหลังเป็นวันที่ 5 เมษายน ประมาณ 10 บิล ต้องการให้เลขที่บิล กลับไป running IV62-04-05-01 ...02...03 ผมจะต้องแก้ตรงไหนครับ
Private Sub Text185_DblClick(Cancel As Integer)
Dim strDate As String
Dim intNum As Integer, intMax As Integer
Dim strSuffix As String
strDate = "IV" & "" & (Format(DATE, "yy-mm-dd"))
If Me.voucher_s_id = "" Or IsNull(Me.voucher_s_id) Then
If IsNull(DMax("Val(Mid([voucher_s_id],10))", "voucher_s", "Left([voucher_s_id],10) = '" & strDate & " '")) Then
Me.voucher_s_id = strDate & "-" & "01"
Debug.Print "1"
Else
intMax = DMax("Val(Mid([voucher_s_Id],12))", "voucher_s", "Left([voucher_s_id],10) = '" & strDate & " '")
intMax = intMax + 1
Me.voucher_s_id = strDate & "-" & Format(intMax, "00")
Debug.Print "1"
End If
End If
End Sub
Private Sub Text185_Enter()
'Private Sub bill_no_Enter()
Dim strDate As String
Dim intNum As Integer, intMax As Integer
Dim strSuffix As String
strDate = "IV" & "" & (Format(DATE, "yy-mm-dd"))
If Me.voucher_s_id = "" Or IsNull(Me.voucher_s_id) Then
If IsNull(DMax("Val(Mid([voucher_s_id],10))", "voucher_s", "Left([voucher_s_id],10) = '" & strDate & " '")) Then
Me.voucher_s_id = strDate & "-" & "01"
Debug.Print "1"
Else
intMax = DMax("Val(Mid([voucher_s_Id],10))", "voucher_s", "Left([voucher_s_id],10) = '" & strDate & " '")
intMax = intMax + 1
Me.voucher_s_id = strDate & "-" & Format(intMax, "00")
Debug.Print "1"
End If
End If
End Sub