Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flashing textbox, again!

Status
Not open for further replies.

jj22171

MIS
Jun 22, 2007
39
CA
I've read all the threads about this subject but still can't seem to make it work for me.

My form accepts input from user to run a query and reports. To inform the user of the progress of the processing, there's a textbox which is given a value of the status. The form has the following with time interval set to 400.
Private Sub Form_Timer()
If Me!txtStatus <> "" Then
Me!txtStatus.Visible = Not Me.txtStatus.Visible
End If
end sub

But when a query is running and a report is being prepared for previeving through separate modules, the textbox doesn't flash. I sensed it has something to do with SetFocus but don't know for sure or how to make it work.

Would greatly appreciate any help/thoughts.
Thanks.


 
I don't believe a form can be repainted while a query is running in the background. I believe all of Access's resource are focused on that until the query is complete.

You can run the query from vba and set a progress message in the status line before and after the query to let the user know what is going on.

Not sure if that helps.

ProDev, MS Access Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Perhaps this ?
Private Sub Form_Timer()
If Me!txtStatus <> "" Then
Me!txtStatus.Visible = Not Me!txtStatus.Visible
DoEvents
End If
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks guys,

I tried PHV's suggestion and still doesn't work. It looks like Loonie is right. The flashing text works by itself but once you do a query even using vba, the form repaint won't work. Anyway, I guess a pop-up form with unflashing status message would be enough for now.

Thanks again.
 
I can't agree with Lonnie. A form can be repainted while the db runs a query. for example My form has timer set on, timer interval=100 and it does the following perfect.
Code:
Option Compare Database

Private Sub Command0_Click()
    InsertData
End Sub

Private Sub Form_Timer()
    Select Case Me.Label2.BackColor
    Case Is = vbRed
        Me.Label2.BackColor = vbGreen
    Case Is = vbGreen
        Me.Label2.BackColor = vbRed
    Case Else
        Me.Label2.BackColor = vbRed
    End Select
End Sub
Sub InsertData()
    Dim sql As String
    sql = "Insert into Table1 (MyField) values ('My Detailed data')"
    Dim x As Integer
    DoCmd.SetWarnings False
    For x = 0 To 10000
        Me.Label2.Caption = "Working on row number " & x
        DoCmd.RunSQL sql
        DoEvents
    Next
    DoCmd.SetWarnings True
    MsgBox "Finished inserting data"
End Sub

It inserts data, updates the label and the label keeps on changing the background color with timer


________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Zameer, your code execute 10001 times a single INSERT query.
What happens with a bulk insert of 10001 rows ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top