Results 1 to 5 of 5
  1. #1
    Thomasso is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250

    Initialization form with changing textbox value

    Hello,

    I am doing various checks when an Access app is opened (user credentials, linking tables from SQL server, updating currency rates, etc...).

    I want to display a "welcome init" form which will inform the user about what's going on, so the app does not look like it's frozen.

    I currently have something like this:

    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub Form_Load()
    
        Me.TimerInterval = 1
    
        Me.cmdOK.Visible = False
        Me.cmdClose.Visible = False
        Me.txtProgress.Visible = False
    
    End Sub
    
    Private Sub Form_Timer()
    
        Me.TimerInterval = 0
    
        Me.txtProgress.Visible = True
        Me.txtProgress.Value = "Connecting to database..."
    
        LinkSQLTables
    
        Me.txtProgress.Value = "Verifying user credentials..."
    
        If UserLogin() = False Then
            Me.txtProgress.Value = "User authorization failed, cannot start the application!"
            Me.cmdClose.Visible = True
            Exit Sub
        End If
    
        Me.txtProgress.Value = "Updating bank transactions..."
    
        Connect
        UpdateBankTransactions (1)
        UpdateBankTransactions (3)
    
        Me.txtProgress.Value = "Updating currency exchange rates..."
    
        UpdateCurrencyExchangeRate (2)
        UpdateCurrencyExchangeRate (3)
        UpdateCurrencyExchangeRate (4)
        Disconnect
    
        If Not IsNull(TempVars("EmployeeID")) Then
            Me.txtProgress.Value = "User successfully verified: " & TempVars("EmployeeName")
            Me.cmdOK.Visible = True
            Me.cmdClose.Visible = False
        Else
            Me.txtProgress.Value = "Error!"
            Me.cmdClose.Visible = True
            Me.cmdOK.Visible = False
        End If
    
    End Sub
    The problem is that this doesn't work properly. The "txtProgress" doesn't at all show the first message "Connecting to database...". It runs the "LinkSQLTables" sub, freezes for a while and then it shows "Verifying user credentials...". I have no idea why, I even tried to pause the code execution between each step, using kernell function "Sleep", but that didn't help either.



    What should I do to achieve this in Access? Thank you.
    Tomas

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Try a Me.Repaint after each textbox update, and use a label instead of a text box, and set it's caption property.
    A label can't get focus, whereas the text box can so it's one less thing to worry about dealing with.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Thomasso is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250
    Epic, thanks a lot!

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Kinda looks odd to set timer to 1 millisecond then turn it off right away. Why not just do this in the form open event? I agree with the suggestion to Repaint and use labels. You could also entertain the idea of a splash screen to break up the monotony. IIRC, opening processes will still run as long as the splash is not modal.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    I think you can do an actual progress bar also, search net for "progress bar in ms Access". Saw a few examples of how to do it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-10-2023, 12:46 PM
  2. Replies: 3
    Last Post: 05-04-2017, 07:23 AM
  3. Initialization Module/Class
    By swalsh84 in forum Modules
    Replies: 1
    Last Post: 12-13-2014, 12:25 PM
  4. Replies: 12
    Last Post: 12-10-2013, 08:57 PM
  5. Replies: 1
    Last Post: 07-28-2011, 09:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums