By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,689 Members | 1,731 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,689 IT Pros & Developers. It's quick & easy.

Locking invoice form after printing

P: 38
I'm creating an invoice software (access 2000) in which most of it is over.
Need to consult which is the best way to lock form and subform after saving and printing.
The code I think of using is :
select case me.status
case 1 :'open'
me.allow deletions =true
case 2: 'closed'
me allow deletions=false.
end select.
end sub

My questions:
1. What kind of operations more should I state in the code?
2. should I allow edits in the closed form?
3. need to put a bypass button to the locking of the form. HOW?
Thanks for your help.
Sep 30 '07 #1
Share this Question
Share on Google+
3 Replies


nico5038
Expert 2.5K+
P: 3,072
Hmm, much questions and multiple solutions are possible.

Personally I don't lock forms, but only allow the user to select a specific form based on the status and/or action at hand.
In your case I would have a "Main" form with a subform holdong all invoices and Action buttons for Adding, UpdatingNew, UpdatingMailed, Printing, etc.
Depending on the status of the CurrentRecord the Action buttons will be enabled or disabled.

Checkout my sample at:
http://www.geocities.com/nico5038/xS...tAction-97.zip
It also holds some code how to filter such a subform.

For the printing I always use a separate Msgbox asking the user or the printing went OK, as a printer jam can set a dateprinted (better to use instead of a status, because it's "traceble")
When confirmed I set the DatePrinted and the username in the invoice record.

Getting the idea ?

Nic;o)
Sep 30 '07 #2

P: 38
Thank you for your reply.
I really appreciate your example you refered me to, it's been very helpfull (all of them that you have there, by the way).
The problem I do have is that by law, I'm obliged to lock the form completely from deletions or changes (it's an invoice form).
Can you suggest anything please?
Oct 7 '07 #3

nico5038
Expert 2.5K+
P: 3,072
When you open the properties window directly after opening the form in designmode, then you find under the Data tab the possibility to allow Insert/Update/Delete for the records of the form.
You need however keep in mind that locking this possibility on the form doesn't prevent direct deletions in the original table.
To be 100% sure you would need to use e.g. MS SQL or Oracle as a database that will allow the blockage of a delete by means of database triggers.

Personally I would still use a "Delete" form here, but only set a switch (YesNo field) indicating that the record has been "deleted" and record the datetime and user. Thus you can exclude the record from the datasheet subform and still have the data available for historical tracing.

Nic;o)
Oct 7 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.