If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: Multiple snapshots for each report

However, I would like to keep a copy of each invoice version submitted to the customer (usually there is no more than 4).
My solution would be to create 4 fields “snapshot1“ , “snapshot2“ , “snapshot3“ , and “snapshot4“ for each order.
The Report_Activate function will be removed.
It will be required to select the version before working with the following buttons.
There will be a button “Create snapshot“ which will create the file and save it into the snapshot folder, the file name will be the orderNo.
For the second version, the file name will be the OrderNo & - & 1 like 5657, 5657-1, 5657-2

Another button “Add“, which will fill in the file name into the field snapshot1
Another button “Del“, which will delete the file name from the field snapshot1
Another button “View“, which will search for a snapshot file with a name matched the field snapshot1

What I need now, is a function that searches in the folder for a snapshot with the name matched the field on the form. Can anyone help me with this?

First I was thinking of creating a sub table that keeps the snapshot names for each order, but it turned out to be more coding.

I would appreciate if you can also tell me if there are any other ways.

In my business, the data is being changed from time to time. For an example, I would not issue a credit; I will revise the invoice and send it again. So I would like to see all versions.
Thanks

I would approach this by preserving the changes and handling versioning in the database itself. If you have critical changes in your database that affect your customers, you would behoove yourself to accomodate historical tracking of those changes at the database level as opposed to relying on external file storage.

Anyways, that scripting.filesystemobject I mentioned is probably what you're after.

I do not want to save a copy in a database. Like I said is what I need. To save a snapshot in a separated folder when needed.

I’m still looking for the code for the Private Sub Report_Activate that will check to see if a snapshoot with that order number exists in the folder. If so, ask the user if he wants to create a second version, if so name it 5657-2

I prepared a small sample db, where I already added the buttons needed for the snapshots. I’m sorry for asking but I spent 2 hours for this small issue and couldn’t figure out the code. Can anyone please help me?

When I click on the create button, the function should check if a snapshot file with the current order number exist in the C:\ folder, if yes, ask the user if he wants to create a second version, if yes, create another snapshot with order number plus “,1” etc.

I very appreciate your help. Especially as you see that I’m spending days on such a small function.

I have revised the form and added more functions. However, I was not able to plug-in your code into my function. Can you please open the attached DB and see where I highlighted the line that needs to be update.

what you could consider doing is adding the customer number and timestamp (in YYYYMMDDHHMMSS format) of the report generation as a suffix to the snashot filename. that should work assuming that you never get two users trying to generate ther same report for the saem customer at the same time.

However to me it smacks of a design problem.. if your design is right you shouldeb able to view all the history on the invoice on screen and generate a reprot as required. Im surprised that you generate revised invoices, I thought it was industry practise to send any corrections on a new invoice so that both sides have traceability on the invoice and any changes.

the bit of code that has been commented out (which is what i assume you meant by highlighted) deals with loading the saved snapshot back into access, which isn't what you asked about. and is frankly something i don't think you can do in access.

the code i provided would have served inplace of that if...elseif...elseif...Endif that you've used to find it