【引用外部鏈接圖片】【隱藏Access后臺(tái)界面】【注冊(cè)登錄窗體】
引用外部鏈接圖片
Dim imagepath As String
Private Sub 圖片名稱(chēng)_DblClick(Cancel As Integer)
imagepath = CurrentProject.Path & "\" & "圖片\" & Me.圖片名稱(chēng) & ".png"
Forms("引用外部鏈接圖片").image圖像.Picture = imagepath
End Sub
隱藏Access后臺(tái)界面
隱藏后臺(tái)界面
Public hidden_num As Integer
Public restore_num As Integer
Private Sub Command隱藏_Click()
If hidden_num = 0 Then
hidden_num = 1
restore_num = 0
fSetAccessWindow (0)
Else
hidden_num = 0
showwindow Access.Application.hWndAccessApp, 5
End If
End Sub
Private Sub Form_Timer()
If restore_num = 0 Then
DoCmd.Restore
restore_num = 1
End If
End Sub
模塊1
Public Declare PtrSafe Function showwindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare PtrSafe Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Function fSetAccessWindow(nCmdShow As Long)
Dim loX As Long
Dim loForm As Form
On Error Resume Next
loX = apiShowWindow(hWndAccessApp, nCmdShow)
Err.Clear
fSetAccessWindow = (loX <> 0)
End Function
注冊(cè)登錄窗體
Private Sub 登錄_Click()
If 賬號(hào) <> "" And 密碼 <> "" Then
? ? If Me.密碼 = DLookup("密碼", "賬號(hào)密碼表", "賬號(hào)='" & Me.賬號(hào) & "'") Then? ?'修改域函數(shù)參數(shù)
? ? ? ? MsgBox "登錄成功"
? ? ? ? DoCmd.OpenForm "系統(tǒng)主頁(yè)", acNormal, , "賬號(hào)='" & Me.賬號(hào) & "'"
? ? ? ? DoCmd.Close acForm, Me.Name
? ? Else
? ? ? ? MsgBox "賬號(hào)或密碼錯(cuò)誤"
? ? End If
Else
MsgBox "請(qǐng)輸入賬號(hào)和密碼"
End If
End Sub
Private Sub 退出_Click()
Application.Quit acQuitSaveAll
End Sub
Private Sub 注冊(cè)_Click()
If 賬號(hào) <> "" And 密碼 <> "" Then
? ? If DCount("密碼", "賬號(hào)密碼表", "賬號(hào)='" & Me.賬號(hào) & "'") > 0 Then
? ? MsgBox "該賬號(hào)已存在,請(qǐng)輸入其他賬號(hào)"
? ? Exit Sub
? ? Else
? ? DoCmd.SetWarnings (False)
? ? Dim add_sql As String
? ? add_sql = "Insert Into 賬號(hào)密碼表 (賬號(hào),密碼) Values ('" & 賬號(hào) & "','" & 密碼 & "')"
? ? DoCmd.RunSQL add_sql
? ? MsgBox "注冊(cè)成功"
? ? Exit Sub
? ? End If
Else
MsgBox "請(qǐng)輸入注冊(cè)的賬號(hào)和密碼"
End If
End Sub