*moved here from PM*
torz said:
Thanks heaps for the detailed reply! makes things so much easier for us noobs trying to learn
I still have no idea where to start, nor what the difference between putting code in a class, module or form itself is...
When you say I need to create a class object, I have no idea where to start. I have looked at the example like 100+ times but I'm way to new to understand where to start I think... after the reply I think I need to use the code you have in the frmtestmetre form and for the action & task values I need to use either sql or dcount to get the number of records it is going to download.
The download would become the task value & the action would be task x 2 (it will download them & update a different table)
Is that anywhere near close to what I need to do?
Thanks heaps!
Okay for starters, classes are modules that are used to create custom objects. Objects are just 'things' you interact with, such as forms, recordsets, tables, and the like. The clsMeter module is a class module that can be used to create a clsMeter object. Note that the graphic next to the name in your Modules tab is different than in a regular module! With that in your project, in your driver (the code that will be handling the import), you create the meter obejct with something like this:
With that, you just created a clsMeter object called 'Meter'. It's just like when you create a recordset object or a form object to reference in your code, except rather than using a built-in object, you're using a custom one. If that's still Greek to you, try doing google searches on 'object-oriented programming' and 'class modules'.
Once you've created the object, you can use it to execute the built-in functions. So with an object you named Meter, you can use Meter.Initialize and Meter.Update. Once you're done, just do "Set Meter = Nothing", and that will close the form and clear the object reference.
Now, for the rest of what you are trying to do:
By downloading, do you mean your user is downloading a file to a local or network folder, or that they are actually importing the records directly into the database? How are you handling the actual import - TransferSpreadsheet? If so, my meter is of no use with that one - for that transfer progress, you're best off just turning on the hourglass and letting Access show its own meters. If you're doing a line-by-line import from a text file or Excel, that's a different matter.
Basically, the meter module simply tracks a single iterative task, and shows progress through the iterations. For example, if you're importing a spreadsheet one line at a time for some reason (say for data cleaning), you can use Excel methods to get the number of lines to be processed, and that gives you a count to work through. You can certainly use the meter to show progress through a series of linked automated tasks, but I didn't include functionality to change the displayed text. (I probably should, but it never occurred to me.)
So I guess the above is my long-winded way to ask this:
What PRECISELY are you doing? I know 'downloading and then updating records', but how are you going about it?