55
ห้อง MS Access / : ใส่ชื่อฟิลด์เป็นภาษาไทยใน Query
« เมื่อ: 19 ส.ค. 64 , 15:33:04 »ไปที่ VBA Editor ไปที่ TOOL > References
ไปกดติ๊กเลือก Microsoft Excel xx.x Object Library มาด้วยครับ
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.
ไปที่ VBA Editor ไปที่ TOOL > References
ไปกดติ๊กเลือก Microsoft Excel xx.x Object Library มาด้วยครับ
Option Explicit
Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Public Sub On_Top(ByVal lhWnd As Long)
SetWindowPos lhWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Public Sub NotOn_Top(ByVal lhWnd As Long)
SetWindowPos lhWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End Sub
Copy codeมาหน่อยครับต้องดูว่า MS Office ใช้กี่ Bit
ครับ ถ้า 32bit ไม่น่าจะมีปัญหาอะไร
แต่ถ้า 64 bit ต้องมีคำว่า prtSafe ด้วย เช่น
Private declare prtsafe function ...........................
แดงแบบเดิมเลยครับ
ผม 64 บิทครับ
Private Sub Command4_Enter()
Dim fpass As String, fusername As String
If IsNull(Me.UserBox) Then
MsgBox "กรุณาระบุ UserName", vbInformation, "ข้อผิดพลาด"
Exit Sub
ElseIf IsNull(Me.PassBox) Then
MsgBox "กรุณาระบุ Password", vbInformation, "ข้อผิดพลาด"
Else
fusername = Nz(DLookup("[UserName]", "UserV", "[UserName]='" & Me.UserBox & "'"))
If fusername = "" Then
MsgBox "ชื่อผู้ใช้ไม่ถูกต้อง", vbCritical, "ไม่พบชื่อผู้ใช้งาน"
Else
fpass = Nz(DLookup("[Password]", "UserV", "[UserName]='" & Me.UserBox & "'"))
If fpass = Me.PassBox Then
DoCmd.Close acForm, Me.name
DoCmd.OpenForm "PIScreen_vaccine"
Else
MsgBox "รหัสผ่านไม่ถูกต้อง", vbCritical, "พบข้อผิดพลาด"
End If
End If
End If
End Sub
Private Sub PassBox_AfterUpdate()
Command4_Enter
End Sub
Private Sub BtnLogIn_Click()
Command4_Enter
End Sub
Dim fpass As String, fusername As String
If IsNull(Me.Userbox) Then
MsgBox "กรุณาระบุ UserName", vbInformation, "ข้อผิดพลาด"
Exit Sub
ElseIf IsNull(Me.PassBox) Then
MsgBox "กรุณาระบุ Password", vbInformation, "ข้อผิดพลาด"
Else
fusername = Nz(DLookup("[UserName]", "UserV", "[UserName]='" & Me.Userbox & "'"))
If fusername = "" Then
MsgBox "ชื่อผู้ใช้ไม่ถูกต้อง", vbCritical, "ไม่พบชื่อผู้ใช้งาน"
Else
fpass = Nz(DLookup("[Password]", "UserV", "[UserName]='" & Me.Userbox & "'"))
If fpass = Me.PassBox Then
DoCmd.OpenForm "PIScreen_vaccine", acNormal, "", "", , acNormal
Else
MsgBox "รหัสผ่านไม่ถูกต้อง", vbCritical, "พบข้อผิดพลาด"
End If
End If
End If