Results 1 to 4 of 4
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670

    Why is Label Never Updated?


    I want to write to a label when the process begins so that the user is aware of what is going on. I have this syntax, but the label is never updated?

    What should I alter so that the label get's updated and the user is aware?

    Code:
    Private Sub btnRunStoredProc_Click()
    Dim cmd As ADODB.Command
    
    
        'Updating the label with a message to inform user process has not frozen up
        Me.messagelabel.Visible = True
        Me.messagelabel.Caption = "Querying database to get this information."
    
    
        'Running stored proc
        Set cmd = New ADODB.Command
    
    
        With cmd
            .ActiveConnection = "Provider=ConnectionString"
            .CommandTimeout = 0
            .CommandType = adCmdStoredProc
            .CommandText = "SQLServerStoredProc"
            .Execute
        End With
        
        Set cmd = Nothing
    
    
        'Repainting the form
        Me.[Helper subform].Form.Requery
        Me.[Helper subform].Visible = True
    
    
        'Updating message to nothing
        Me.messagelabel.Visible = False
        Me.messagelabel.Caption = ""
        
    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just before your 1st Set command do a DoEvents.

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670
    Quote Originally Posted by RuralGuy View Post
    Just before your 1st Set command do a DoEvents.
    Such a simple fix! And why have I never heard of DoEvents before?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're welcome.

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

Similar Threads

  1. Replies: 8
    Last Post: 03-12-2016, 02:06 PM
  2. Want subform updated
    By GeorgeJ in forum Programming
    Replies: 4
    Last Post: 02-15-2015, 12:18 PM
  3. Replies: 1
    Last Post: 04-25-2014, 11:41 AM
  4. Replies: 1
    Last Post: 12-11-2012, 02:57 PM
  5. autofill box is always updated as 0.
    By mejia.j88 in forum Forms
    Replies: 7
    Last Post: 11-08-2011, 07:15 PM

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