Update field on form to show progress of processing data

G

Guest

Access 2003 -

As part of a script that builds a table from another table that was
imported, I would like to update the text field within a form that will show
progress as the script is stepping through all the records of the table.
Based on the my script below, I would expect that the "MessageBox" form would
be displayed and text box "text3" would be updated with the messages I'm
sending to it while the script is executing. In fact, the "Messagebox" forms
doesn't appear to even open.

DoCmd.OpenForm "MessageBox", acNormal, , , , , acWindowNormal
For DBInfoFeedRec = 1 To TotalRecs
Forms!MessageBox.Text3 = "Processing record " & DBInfoFeedRec
DoCmd.GoToRecord acDataForm, "DBInfoFeed-10", acGoTo, DBInfoFeedRec
StaffName = Forms![DBInfoFeed-10].[S-LastName] & ", " &
Forms![DBInfoFeed-10].[S-FirstName]
DoCmd.GoToRecord acDataForm, "Staff", acLast
StaffTotalRecs = Forms!Staff.CurrentRecord
DoCmd.GoToRecord acDataForm, "Staff", acFirst
If StaffTotalRecs = 0 Then
DoCmd.GoToRecord acDataForm, "Staff", acNewRec
Forms!Staff!firstname = Forms![DBInfoFeed-10].[S-FirstName]
Forms!Staff!lastname = Forms![DBInfoFeed-10].[S-LastName]
Else
StaffNameFound = False
For StaffRec = 1 To StaffTotalRecs
If StaffRec < (StaffTotalRecs + 1) Then
CurRecStaffName = Forms!Staff!lastname & ", " &
Forms!Staff!firstname
If CurRecStaffName = StaffName Then
StaffNameFound = True
Exit For
End If
If StaffRec < StaffTotalRecs Then DoCmd.GoToRecord
acDataForm, "Staff", acNext
End If
Next StaffRec
If Not StaffNameFound Then
DoCmd.GoToRecord acDataForm, "Staff", acNewRec
Forms!Staff!lastname = Forms![DBInfoFeed-10].[S-LastName]
Forms!Staff!firstname = Forms![DBInfoFeed-10].[S-FirstName]
End If
End If
Next DBInfoFeedRec
 
G

Guest

If you run this code from another form and this form PopUp Property set to
Yes, then the message box will be opened behind the first form, and it will
look like the message form was never opened.

Also, add DoEvents after you assign a value to the message form, so it will
force that event

Forms!MessageBox.Text3 = "Processing record " & DBInfoFeedRec
DoEvents
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top