Solved

Code to access form

Posted on 2014-01-30
3
336 Views
Last Modified: 2014-02-05
I am wondering is the below is possible and if it is relatively easy to do:

I have a form that creates customer invoices. If the invoice is more than 1 day old and someone wants to change the prices on the invoices, I would like them to have to enter a "password". That "password" that would allow them to change the price field would be the form ID number times 2 (or some similar formula). They wouldn't know this formula... it would only be known for me.

In the end... if one of my works wants to change the price field of a form that is older than one day old, they would have to email me the reason. In order for me to give them the "password" I would simply multiply the ID# times two and that would give them access.

Is this something that is possible? How hard is it to do?
0
Comment
Question by:cansevin
3 Comments
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
Comment Utility
Use the BeforeUpdate event of the Price control.
If Me.SomeDate <  Date() - 1 Then
    If InputBox("Enter Password" <> "some string") Then
        Cancel = True
        Msgbox "Change not allowed without valid password.",vbOKOnly
        Me.Price.Undo
        Exit Sub
    End If
End If

Open in new window


This code shows a hard-coded password string.  I don't know where in the database you intend to store the valid password so substitute a DLookup() or whatever you need to get the valid password.
0
 
LVL 13

Expert Comment

by:MrBullwinkle
Comment Utility
I'm guessing you have a table that has Date, Invoice Number, and Invoice price, which is displayed on a form, and you click it to show a report with more detail on the invoice?

It's not an issue to put a check condition under a button before displaying an Inputbox or something to enter a new price, but it seems from the question this is not how your form is setup.  

In any case, I would recommend you make the password more complex than a simple math equation.  I would use a "real" Hash myself, but something simply might be to use a salt (a prefix and/or suffix of the passcode), and a simple 'encryption' of the form number, by maybe doing a modulus of the invoicenumber by 26, and converting that number to a letter?  

Eg, Passcodes would be "ABC" & chr(InvoiceNo mod 26+ 64) & "123"

If InvoiceNo was 100, then 100mod26 is  22. The 22nd letter is W so passcode is "ABCW123".  Invoice number 1 is "ABCA123"

Maybe just use a hexadecimal version of the invoice number? Depends how secure you want this passcode.
0
 

Author Comment

by:cansevin
Comment Utility
Thank guys... this is a great starting point. I am not real concerned with security of the password at all. I appreciate your thoughts.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now