เลขที่อินวอยซ์ไม่runต่อ ของfield Voucher_e_id

เริ่มโดย kunlek, 14 ก.ค 19 , 22:43:21

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

kunlek

ฟอร์มค่าใช้จ่าย(Vat) เลขอินวอย์ซ running ตามปกติ   แต่อีกฟอร์ม ค่าใช้จ่ายรวมบิล(Vat) ไม่ running ได้ใบเดียว รบกวนท่านที่เคารพ ช่วยดูหน่อยครับผิดตรงไหน
  •  

PNR

#1
อ้างถึงจาก: kunlek ใน 14 ก.ค 19 , 22:43:21
ฟอร์มค่าใช้จ่าย(Vat) เลขอินวอย์ซ running ตามปกติ   แต่อีกฟอร์ม ค่าใช้จ่ายรวมบิล(Vat) ไม่ running ได้ใบเดียว รบกวนท่านที่เคารพ ช่วยดูหน่อยครับผิดตรงไหน

PA 2 ตัวอักษร Mid 12 Left 10
ถ้า 4 ตัวอักษร แบบ PANV Mid ต้อง 14 Left 12
แก้ไขใหม่เป็นแบบนี้ึครับ

Sub ForIsToday()
Dim strDate As String
Dim intNum As Integer, intMax As Integer
Dim strSuffix As String
strDate = "TA" & "" & (Format(Now, "yy-mm-dd"))
   If Me.voucher_e_id = "" Or IsNull(Me.voucher_e_id) Then
        If IsNull(DMax("Val(Mid([voucher_e_id],12))", "voucher_e", "Left([voucher_e_id],10) = '" & strDate & " '")) Then
            Me.voucher_e_id = strDate & "-" & "01"
            Debug.Print "1"
        Else
            intMax = DMax("Val(Mid([voucher_e_id],12))", "voucher_e", "Left([voucher_e_id],10) = '" & strDate & " '")
            intMax = intMax + 1
            Me.voucher_e_id = strDate & "-" & Format(intMax, "00")
            Debug.Print "1"
        End If
End If
End Sub

Sub ForIsOtherday()
Dim strDate As String
Dim intNum As Integer, intMax As Integer
Dim strSuffix As String
strDate = "TA" & "" & (Format(date_exp, "yy-mm-dd"))
    If Me.voucher_e_id = "" Or IsNull(Me.voucher_e_id) Then
        If IsNull(DMax("Val(Mid([voucher_e_id],12))", "voucher_e", "Left([voucher_e_id],10) = '" & strDate & " '")) Then
            Me.voucher_e_id = strDate & "-" & "01"
            Debug.Print "1"
        Else
            intMax = DMax("Val(Mid([voucher_e_id],12))", "voucher_e", "Left([voucher_e_id],10) = '" & strDate & " '")
            intMax = intMax + 1
            Me.voucher_e_id = strDate & "-" & Format(intMax, "00")
            Debug.Print "1"
        End If
End If
End Sub
Time to stop for me  :dizzy:
  •  

kunlek

  •