Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102

    Scrolling marquee not refreshing with main form

    On my main form I have a text box with scrolling text that a count from a query is shown, but it does not refresh if criteria that feeds the query changes. I can send the code it is on the on timer event of the form.

  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
    I'm not sure why changing the criteria would make any difference but looking at the code would help in the understanding.

  3. #3
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    This is the code for the scrolling text

    Code:
    Private Sub Form_Timer()
       Static strMsg As String
       Static intLet As Integer
       Static intLen As Integer
       Dim strTmp As String
       Const strLen = 150
       If Len(strMsg) = 0 Then
          strMsg = Space(strLen) & "There are" & " " & DCount("[newtestdate]", "[query6]") & " " & "tests and certificates that need your attention, please double click here! " & Space(strLen)
          intLen = Len(strMsg)
       End If
       intLet = intLet + 1
       If intLet > intLen Then
          intLet = 1
       End If
       strTmp = Mid(strMsg, intLet, strLen)
       Me!lblscroll.Caption = strTmp
       If strTmp = Space(strLen) Then
          intLet = 1 'Re-start scrolling
       End If
    End Sub

    This works fine after the initial loading of the main form but if an item changes on the main form it should reduce the number generated by query6.
    Last edited by RuralGuy; 08-25-2016 at 06:36 AM. Reason: Added code tags and indentation

  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
    Are you saying that [newtestdate] or [query6] are no longer valid?

  5. #5
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    No they are still valid, if a certificate or MOT date is entered against a vehicle I would like the scrolling text number to decrease on the fly after close the certificate form. When a MOT is entered the main form updates and shows that the MOT is now good, but the scrolling text remains the same number until the database is closed and reopened or the main form is closed and reopened.

  6. #6
    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
    Why not let your Timer Event scroll a Public String, rather that this private one, and then set the string from whatever code you are using to to deal with the MOT's (whatever that is)?

  7. #7
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Is that by simply changing the 'Private sub' to a 'public sub' in vba or rewriting the whole vba, sorry for sounding ignorant.

  8. #8
    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
    Public Objects are declared *outside* of any Procedure, usually at the top of the class module involved.

    Option Compare Database
    Option Explicit

    Dim YourVariable As String

    Private Sub...

  9. #9
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Ok I will try moving it to the top of the module.

  10. #10
    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
    Let us know how you make out.

  11. #11
    tonycl69 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2012
    Posts
    102
    Moved it to the top but still not refreshing the count. Does the ontimer event only trigger once when the form is opened can it not be refreshed directly.

  12. #12
    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
    On the Event tab of the Properties Sheet for the Form is the "Timer Interval" property. It is in Milliseconds so 1000 = 1 second. To what is yours set?

  13. #13
    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
    Hmm...I'm sorry but I thought you were talking about the Marquee not scrolling, not the Count not changing. I need to think a bit. At first blush I would think the DCount should run every Timer Event.

  14. #14
    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
    What does [query6] accomplish? Maybe the record count for that query does not change until your form is done.

  15. #15
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    Maybe try to refresh the form or that control after each run at the bottom of the timer event. Not sure if any of these would work, you don't need all of them, just giving options.

    Forms!MyForm.Requery (change MyForm with actual name of your form.)
    Forms!MyForm.Refresh
    Forms!MyForm.RePaint

    Me.lblscroll.Requery
    Me.lblscroll.Refresh
    Me.lblscroll.Repaint

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Scrolling Marquee using Query Results
    By thexxvi in forum Access
    Replies: 3
    Last Post: 08-12-2016, 09:29 AM
  2. Replies: 4
    Last Post: 02-11-2016, 11:22 AM
  3. Replies: 10
    Last Post: 09-22-2015, 08:06 PM
  4. Replies: 2
    Last Post: 04-22-2014, 02:48 PM
  5. Replies: 10
    Last Post: 11-19-2012, 10:57 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