Solved

Code to access form

Posted on 2014-01-30
3
341 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
ID: 39821464
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
ID: 39821523
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
ID: 39821591
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

895 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

15 Experts available now in Live!

Get 1:1 Help Now