Solved

Code to access form

Posted on 2014-01-30
3
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

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:Ryan
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 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