Solved

Code to access form

Posted on 2014-01-30
3
350 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 38

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

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.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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 …

630 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