Solved

Code to access form

Posted on 2014-01-30
3
343 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 35

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

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…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

839 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