#1 FORM BACKGROUNDS
Microsoft Access is a very powerful tool for users in the office environment to create databases. It is possible to develop successful applications, especially if you know some vba coding.
However, the default userform design options are unfortunately very limited.
It is also possible to produce successful interfaces by spending some time.
We are preparing a series of several videos on this subject. In this video, we will explain how to create more colorful, simple and dynamic backgrounds and interactive visual user login screen design.
This is a user login form that is created automatically with the "create form" command.
After 15minsYou can have a form like this..
The following main steps are desciribed in the video.
Create custom design images for your background
Put an image onto your form and resize it on every form_load. by VBA
Disable and hide all other controls except your "log in" / "exit buttons"
Make your login form as permanent (set modal)
Dynamic user images would be fine..
Download;
Used in Youtube video..
For the next videos..
The VBA Code:
Option Compare Database
Private Sub Form_Close()
HideRibbon True 'don't forget to set toolbars visible
End Sub
Private Sub Form_Load()
HideRibbon False 'set toolbars
DoCmd.Maximize 'maximize
Me.Image0.Width = Me.InsideWidth 'set image width to the form max width
DoCmd.OpenForm "LOGINFORM" 'open login form
End Sub
Private Sub Form_Resize()
Me.Image0.Width = Me.InsideWidth 'if form size changed set the image dimension
End Sub
Option Compare Database
Private Sub Combo20_Change()
Me.txtpassword = ""
Me.imguser.Requery
End Sub
Private Sub Command24_Click()
If Nz(Me.Combo20) = "" Then MsgBox ("please select username"): Exit Sub
If Nz(Me.txtpassword) = "" Then MsgBox ("please enter your password"): Exit Sub
If Nz(Me.txtpassword) <> Me.password Then MsgBox ("wrong password"): Me.txtpassword.SetFocus: Exit Sub
'if the password is ook
DoCmd.OpenForm "frmmain"
Me.Visible = False
End Sub
Option Compare Database
Function getuserimage()
'Returns the path of the selected user'image file on the folder \system\users based on the user ID
'-----------------------------------------
If IsNull(Form_LOGINFORM.Combo20) Then
txtimagename = "0" 'if no user selected on the login form, returns "0"
Else
txtimagename = LTrim(Str(Form_LOGINFORM.Combo20)) 'else return ID nr
End If
'preparing the image path
txt = Application.CurrentProject.Path
txt = txt + "\system\users\"
txt = txt + txtimagename + ".jpg"
getuserimage = txt
End Function
Public Sub HideRibbon(onoff As Boolean)
'show or hide the toolbar
On Error Resume Next
If onoff = False Then
DoCmd.ShowToolbar "Ribbon", acToolbarNo
Else
DoCmd.ShowToolbar "Ribbon", acToolbarYes
End If
On Error GoTo 0
End Sub
Private Sub Command25_Click()
DoCmd.Quit acQuitSaveNone
End Sub
Private Sub Form_Load()
Me.Move Form_FRMMAIN.Width - Me.Width, 0, , Form_FRMMAIN.Form.Section(0).Height
Me.Image115.Top = 0
Me.Image115.Height = Me.InsideHeight
End Sub
Comments