I have made several scripts using VB that process various data in MSAccess- check some boxes here, add notes to this text box, and so on based on conditions from a query. They all work exactly how I want them to, but some of them run for a rather long time and I would like to be able monitor the progress of the scripts.
My first thought was to create a Form right before the process starts and after every iteration of the process, update a label on the form that says, "12 out of 99,456 records processed." or possibly even draw a small blue rectangle and keep increasing the size of it to illustrate the progress like other programs often do.
I have relatively little experience in VB programming, but I know this would be a piece of cake in Java. When I tried implementing this in VB I found that I can't make any modifications to a Form while in Form View. Is there a way around this?
I also considered using a TextBox (surely this can be changed in FormView) and disguising it as a Label since I think TextBoxes look really tacky to display info that can't be modified. I ran into a problem here too, though. Here's what I did:
Dim strFormName As String
Dim frmProgress As Form
Dim cl As Control
Set frmProgress = CreateForm()
frmProgress.NavigationButtons = False
frmProgress.RecordSelectors = False
strFormName = frmProgress.name
Set cl = CreateControl(strFormName, acTextBox, acDetail, "", "", 100, 100, 5000, 300)
DoCmd.OpenForm (strFormName) ' open FormView
cl.Text = "Connecting to Database"
I get a: Run-time error '2467' Application-defined or object-defined error on the last line listed here.
Surely there is someone out there who has done this kind of thing before, and surely there is a way to implement this. I'm very close to scrapping everything I've done using the MS Access VB and just starting over with the front end with a platform that allows more control. Am I getting frustrated because I don't know what I'm doing or is it because MS VB is just not very flexible?
Thanks for any ideas you may have.