181
ห้อง MS Access / : Access + sql server ทำให้ไม่ต้องพิมพ์รหัสผ่านเองทุกครั้ง
« เมื่อ: 12 ก.พ. 63 , 14:59:49 »
สั่งบันทึกรหัสใว้ตอนดึงตารางมาครับ (แนวทางจากอ.TTT ดูที่ 26:35นาที)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
ตามหัวข้อเลยครับ จะทำยังไงครับ จะอัพจากการเลือกใน form แล้วไปบันทึกในฐานข้อมูลเราครับ
แล้วไฟล์รูปภาพเป็นนามสกุลอะไรครับ
Private Sub bill_no_GotFocus()
If Me.shop = "" Then
MsgBox "ป้อนข้อมูล shop ก่อนนะ"
Me.shop.SetFocus
End If
End Sub
DoCmd.OpenReport "ใบกำกับขาย-ต้นฉบับ", acViewPreview, Filename
ขอโทษด้วยน่ะครับ ผมมือใหม่มากกกครับ
คือไม่ทราบว่า โค้ดชุดนี้เอาไปวางไว้ตรงไหน ของ Form_Current event procedure ครับ
ขอบพระคุณครับ
ลำดับ | กล่องเป้าหมาย | รวม |
1 | 1 | |
1 | ||
1 | 1 ชุด | |
2 | 2 | 1 ชิ้น |
3 | 3 | |
3 | 1 ชุด | |
4 | 4 | 1 ชิ้น |
... |
ฟอร์มหลักให้ผูกเข้ากับเทเบิลของข้อมูลหลัก ส่วนฟอร์มย่อยก็ผูกเข้ากับเทเบิลของข้อมูลย่อย จะง่ายกว่าไปผูกกับคิวรี่ซึ่งมีเงื่อนไขในฟอร์มหลักอีกที ดูแล้วงงๆ
นำไปใช้แล้วเลขที่ออกจะเป็น QU6263 แบบตายตัวไม่บวกเพิ่มเลยครับโค๊ด: [Select]Me.QU_No = "QU" & Right([txtDateTH], 2) & Right("00" & DMax("[QU_No]", "[T_Quot v7]", "Left([QU_No],4) = 'QU'") & Right([txtDateTH], 2) + 1, 2)
แค่ใส่เครื่องหมายผิดที่ครับ
Private Sub cmd_QuNew_Click()
If GetUserLocaleInfo(GetSystemDefaultLCID(), &H1009) <> 7 Then
Me.txtDateTH = mYear([txtDate])
ElseIf GetUserLocaleInfo(GetSystemDefaultLCID(), &H1009) = 7 Then
Me.txtDateTH = bYear([txtDate])
End If
Me.QU_No = AutoQuNo
DoCmd.OpenForm "F_Quot v7 Edit"
End Sub
Function AutoQuNo() As String
Dim X As Variant
Dim bk As String
X = DMax("Right(QU_No,2)", "[T_Quot v7]", "Left([QU_No],4) = 'QU' & Right([txtDateTH], 2)")
If IsNull(X) Then bk = 1 Else bk = X + 1
AutoQuNo = "QU" & Right([txtDateTH], 2) & Format(bk, "00")
End Function
Private Sub cmd_QuNew_Click()
If GetUserLocaleInfo(GetSystemDefaultLCID(), &H1009) <> 7 Then
Me.txtDateTH = mYear([txtDate])
ElseIf GetUserLocaleInfo(GetSystemDefaultLCID(), &H1009) = 7 Then
Me.txtDateTH = bYear([txtDate])
End If
' Me.QU_No = AutoQuNo
Me.QU_No = "QU" & Right([txtDateTH], 2) & Right("00" & DMax("[QU_No]", "[T_Quot v7]", "Left([QU_No],4) = 'QU' & Right([txtDateTH], 2)") + 1, 2)
DoCmd.OpenForm "F_Quot v7 Edit"
End Sub