Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2007
    Posts
    148

    Unanswered: Show up in the Form Caption

    I have defined a label -- lblStatus in my Form (the name of the form is frmMail)

    I have a modules which the Form calls up.

    I want to see the progress of the modules. Say I have 10 records in the table and I want to see the label -- lblStatus in the From to print out 1 and then 2 and then 3 and so for.

    In the moduls, I first defined lngcount

    Dim lngCount As Long
    lngCount = 0
    Here are my two lines inside a Do Until loop

    lngCount = lngCount + 1

    Forms!frmMail!lblStatus.Caption = lngCount


    *******************************************

    Needless to say, I don't get want I want. It only print out the final number on the label lblStatus. That is 10.

    Can anyone tell me what did I do wrong?

    Thanks
    Last edited by sweetmail; 12-31-07 at 01:01.

  2. #2
    Join Date
    Jun 2007
    Location
    Maitland NSW,Australia
    Posts
    388
    You could try changing Forms!frmMail!lblStatus to an unbound text box then

    Forms!frmMail!lblStatus ="Record Number: " & lngCount


    Or

    The following is some code that I use to display the progress of record manipulations

    This displays every 100th record counter e.g. 100 200 etc on the status bar and when finished it displays a message showing the total number of records added.

    countem is the number of records

    dim countem

    countem=0

    Do Until EOF(1)

    < various lines of codes then>

    countem = countem + 1
    If countem / 100 = Int(countem / 100) Then
    Dim sttext As String
    sttext = "Count = " & countem
    DoCmd.Echo False, sttext
    End If
    Loop
    < various lines of codes then>
    Close #1
    rst.Close
    Set dbs = Nothing
    DoCmd.Echo True

    MsgBox countem & " records added"

  3. #3
    Join Date
    Sep 2007
    Posts
    148
    Thanks will try and let you go how it goes.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You may also try issuing a repaint command (Forms!MyFormName.repaint) after each increment in the counter.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Sep 2007
    Posts
    148
    This does the trick


    Forms!frmMail.Repaint
    Forms!frmMail!txtStatus = "Record Number: " & lngCount


    Thank you both very very much!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •