Scroll label (1 Viewer)

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
Hello, on my opening form, I want to make the scrolling welcome label, such as Good Morning...and if we opening it in the evening it will say good evening... anyone has a sample?.

Thank you
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:45
Joined
Oct 29, 2018
Messages
21,358
Check out the demo @isladogs posted in this thread.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:45
Joined
May 7, 2009
Messages
19,169
you have to play with the code.
 

Attachments

  • lblScrolling.accdb
    844 KB · Views: 102

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:45
Joined
May 7, 2009
Messages
19,169
i forget the Greetings.
 

Attachments

  • lblScrolling.accdb
    1.1 MB · Views: 107

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
Arnel, how did you get personname, if in my case is not person name, but the word saying " Welcome to the XXX system"
 

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
Anyone can tell me where I am wrong, I tried to copy the opening form of the membership database that I made 14 years ago, but since it was in multi languages, so it is not easy just to copy that. I have to study the method of how string message is also in multi language, so here is highlighted by the system that there is a compile error.
 

Attachments

  • onopenformevent.jpg
    onopenformevent.jpg
    81.1 KB · Views: 98

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:45
Joined
May 7, 2009
Messages
19,169
you need to copy that function/sub from your membership database.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:45
Joined
May 7, 2009
Messages
19,169
Arnel, how did you get personname, if in my case is not person name, but the word saying " Welcome to the XXX system"
modify the Greeting() function and put your Own welcome message there.
 

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
modify the Greeting() function and put your Own welcome message there.

It shows on the form view name Boaz Situmorang, how did you define personName= Boaz Situmorang
 

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
you need to copy that function/sub from your membership database.
I just follow your suggestion Arnel, mine is too complicated because Multilanguage, and even the string massage is Multilanguage, it was 14 years ago, and it is complicated.
 

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
you need to copy that function/sub from your membership database.
Arnel this is function/sub in the opening form (the form to open Switchboard form:
Code:
Dim StrMsg As String
' Note: This is message string #5.
     StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 5")
'Dim dtStart As Date
'dtStart = #8/2/2009#     ' you must edit this date for each customer
'If DateDiff("d", dtStart, Date) > 30 Then
' Note: This is message string #6.
 '   strMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 6")
 'MsgBox [strMsg]
 'Application.Quit ' exit the database
'End If
'Modified by theDBguy@gmail.com
'2/28/2011

Dim strPwd As String
Dim blnSuccess As Boolean

strPwd = CurrentDb.Properties("UserPassword")

If Me.txtPassword = strPwd Then
    NewPasswordSet = True

ElseIf Me.txtPassword = "kby2011" Then
    DoCmd.OpenForm "frmNewPassword", , , , , acDialog
    
Else
    MsgBox [StrMsg]
    'Do something else
    Application.Quit ' exit the database
End If
    If NewPasswordSet Then
    DoCmd.Close acForm, Me.Name
    DoCmd.OpenForm " Switchboard "

End If

End Sub
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

   Call FillFormLabels(Me.Name)

Exit_Form_Open:
   Exit Sub

Err_Form_Open:
    Select Case Err.Number
      Case 2450 'do nothing
       Case Else
           Call ShowError(Err.Number, Err.Description, "Form_Pembukaan." _
               & "Form_Open")
           Resume Exit_Form_Open
    End Select
End Sub

and in the new password form this is the function/sub:
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

   Call FillFormLabels(Me.Name)

Exit_Form_Open:
   Exit Sub

Err_Form_Open:
    Select Case Err.Number
      Case 2450 'do nothing
       Case Else
           Call ShowError(Err.Number, Err.Description, "Form_frmNewPassword." _
               & "Form_Open")
           Resume Exit_Form_Open
    End Select

End Sub

This code for the submit button:
Code:
Option Compare Database
Option Explicit

Private Sub cmdSubmit_Click()
'theDBguy@gmail.com
'2/28/2011
 Dim StrMsg As String
' Note: This is message string #1.
     StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 1")

If Me.txtNewPwd & "" = "" Then
    MsgBox [StrMsg], vbInformation, StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 2")
MsgBox [StrMsg]
    Me.txtNewPwd.SetFocus
ElseIf Me.txtConfPwd & "" = "" Then
    StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 4")
    MsgBox [StrMsg], vbInformation, StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 5")
    MsgBox [StrMsg]
    Me.txtConfPwd.SetFocus
ElseIf StrComp(Me.txtNewPwd, Me.txtConfPwd, vbBinaryCompare) = 0 Then
    StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 6")
    MsgBox [StrMsg], vbInformation, "Success!"
    CurrentDb.Properties("UserPassword") = Me.txtNewPwd
    DoCmd.Close acForm, Me.Name
    NewPasswordSet = True
  
Else
StrMsg = DLookup("MessageString", "[Lookup Message String_Qry]", "[FormName] = '" & Me.Name & "' AND [StringNumber] = 7")

    MsgBox [StrMsg], vbExclamation, "Failed!"
    Me.txtNewPwd.SetFocus
    
End If
    
End Sub

If you see DLookup Msg String because it is multi language when I was in Indonesia, just forget it, my project now is in English, I will take care of it what string will be there.

So my goal is I have a password to open, then in the new password form I will let them to make their own password. So in this matter, I do not need table for the user and password, it is just on the VBA on the form.
Thank you Arnel for your help
 

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
Arnel:
After the IT people enter the password in the opening form, then it will open the form below, then if it is correct it will be true for the user to open the opening form and it will let the user go to the switchboard form.
newpassword.jpg
 

isladogs

MVP / VIP
Local time
Today, 07:45
Joined
Jan 14, 2017
Messages
18,186
Frank
Did you look at my example? See link provided in post #3
 

hfsitumo2001

Member
Local time
Today, 00:45
Joined
Jan 17, 2021
Messages
365
Isla,

How can I change this to on load/open form event:
Code:
Private Sub cmdMarquee_Click()
    
    'Sets the timer for scrolling text
    If Me.cmdMarquee.Caption = "Scrolling Marquee Text" Then
        Me.cmdMarquee.Caption = "STOP Scrolling Marquee Text"
        DoEvents
        Me.cmdMarquee.ForeColor = vbRed
        Me.cmdMarquee.FontWeight = 800
        Me.cmdMarquee.FontSize = Me.cmdMarquee.FontSize + 3
        Me.txtMarquee.Visible = True
        strText = "      IMPORTANT MESSAGE : This database will shortly be closing for essential maintenance work." & _
            " Please save your current task and close the program. Apologies for any inconvenience . . . "
        Me.TimerInterval = intTime
        blnMarquee = True
    Else
        Me.txtMarquee.Visible = False
        blnMarquee = False
        If blnTitleBar = False And blnHeader = False Then Me.TimerInterval = 0
    
        Me.cmdMarquee.Caption = "Scrolling Marquee Text"
        Me.cmdMarquee.ForeColor = RGB(63, 63, 63)
        Me.cmdMarquee.FontWeight = 400
        Me.cmdMarquee.FontSize = Me.cmdMarquee.FontSize - 3
        strText = ""
    End If
End Sub
 

isladogs

MVP / VIP
Local time
Today, 07:45
Joined
Jan 14, 2017
Messages
18,186
Just omit all the code lines referencing cmdMarquee and the entire Else section.
The intTime line also won't be needed if you set the timer interval in the form property sheet.
Similarly the boolean field line is redundant
That probably leaves you with just two code lines

BTW I also have an example login form that includes scrolling text....Password Login - Mendip Data Systems
 
Last edited:

Users who are viewing this thread

Top Bottom