Results 1 to 2 of 2
  1. #1
    iainct is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    1

    Update MS Access Marquee text on each loop

    I admit to being a bit of a novice, but have designed myself a very handy personal MS Access database. I have tried to find a solution to the following on the net, but have been unsuccessful so far, hence my post (the first time I've done this).


    I have a marquee on a form in MS Access, which scrolls the count of "incomplete tasks" to do. A "Tasks COUNT Query" provides a number from zero upwards. After the form loads, the code below scrolls a message (right to left) on the marquee in the form "There are X tasks requiring action." X is the number provided from the "Tasks COUNT Query". I would like the text string on the marquee to update on each loop, so that when I mark a task as complete, the next pass on the marquee shows the number (X) as being the updated count.
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Dim Number AsString

    Set db = CurrentDb
    Set rst = db.OpenRecordset("Tasks COUNT Query")

    IfNot(rst.EOF And rst.BOF)Then
    DoWhileNot rst.EOF
    Number
    = rst![Tasks]
    strTxt
    = strTxt &"There are "& Number &" tasks requiring action."
    rst
    .MoveNext
    Loop
    EndIf
    rst
    .Close
    strTxt
    = Left(strTxt, Len(strTxt))'remove the coma at the end
    strTxt
    = Space(30)& strTxt 'start position

    Set rst =Nothing
    Set db =Nothing
    Me.TimerInterval =180

    EndSubThe following code runs on the form timer interval:
    PrivateSub Form_Timer()
    Dim x

    OnErrorGoTo Form_Timer_Err

    x
    = Left(strTxt,1)
    strTxt
    = Right(strTxt, Len(strTxt)-1)
    strTxt
    = strTxt & x
    lblMarqTask
    .Caption = Left(strTxt,180)
    ExitSub
    Form_Timer_Exit
    :
    ExitSub

    Form_Timer_Err
    :
    Me.TimerInterval =0
    ExitSub
    EndSubI would be grateful for any assistance

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you dont need all this code to get the count, ...its just 1 line:

    msgox Dcount("*","myquery")

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

Similar Threads

  1. Replies: 6
    Last Post: 11-05-2014, 05:27 PM
  2. Replies: 7
    Last Post: 10-28-2013, 03:15 PM
  3. Update table from vba on loop
    By twmr2000 in forum Access
    Replies: 4
    Last Post: 10-24-2013, 12:04 PM
  4. Replies: 1
    Last Post: 05-17-2013, 08:35 AM
  5. How to update subform records using loop
    By tahirsatti in forum Forms
    Replies: 15
    Last Post: 05-13-2013, 01:22 AM

Tags for this Thread

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