• User defined default (2000)

    Author
    Topic
    #381643

    Is it possible to establish a user-defined default value for a form? I have a form with a textbox where a weekly fuel surcharge (FSC) is entered as a percent value. This value may (or may not) change every Monday afternoon. Right now a manager gets this value from the Department of Energy and must open the form in design view to change the default value of the textbox. Might there be some method of accomplishing this without allowing design-view access? (We had some “issues” with that). Considering the limited security issues with Access, I also wondered if there might be some trick to only allowing the manager to make this entry. We discused issuing a “memo” each Monday afternoon to the operators, but found that even with this FSC notice there was the occational entry error due to keying or the failure to check the current FSC.

    Any help gretly appreciated!

    Viewing 1 reply thread
    Author
    Replies
    • #644289

      The first thing that pops into my head is to add a table to the db that contains the default values for the form.

      Then in the Form_Current Event, check to see if the user is on a new record and then populate the fields on the form with the default values from the table.

      You, also, may want to create a form to access the default values, so the user is not opening the table directly.

      • #644291

        That sounds reasonable. Will give it a try this evening and post back

        Thanks!

      • #644485

        Thanks so much for you input Bryan (see next post)

        Bryan

    • #644290

      You could create a table with one field (FSC) and just one record to hold the current value.
      Create a simple form based on the table that lets the manager edit this value (set AllowAdditions and AllowDeletes for this form to False – you don’t want the record to be deleted or records to be added, unless you want to keep a history of FSC values)
      In the OnLoad event of the main form, get the current value of FSC from the table (use a DLookup for it, or open the table as a recordset and get the FSC field from the recordset). Then, set the DefaultValue property of the text box to the value you just got.

      The code could look like this (substitute the appropriate names)

      txtFSC.DefaultValue = DLookup(“FSC”, “tblFSC”)

      If you use Access user-level security, you can make the form for editing FSC available to some users only. Otherwise, you could ask for a password on opening this form (but that is not really secure; if you don’t have user-level security people can manipulate the database in several ways; it’s just a way of preventing people from accidentally changing the FSC value).

      • #644293

        Thanks Hans! I like that line of logic. As I have to be in a meeting in ten minutes, I’ll give this a try this evening and post back with my attempts. Very much appreciate your input as always!

        Bryan

      • #644488

        Thanks Hans (and Bryan)!

        What a great way to deal with the issue. I created a table with a single entry for the FSC (ComboBox-list values). I then created a form (Additions/Deletes – False) for the manager to have an easy means of entry (Combo prevents keyboard errors [i.e. 1 vrs. .01 as percent] which is accessed from the switchboard. The OnLoad code works perfectly! I also set the form on the swithboard (Manager Options) to be viewable to the admin privileges only.

        This is a great (and clean) way to resolve the problem. Thanks, once again, for making me out to be the hero!

        Bryan

      • #644491

        BTW (and for anyone watching this post) on the frmOrderEntry I left the text box containing the FSC as editable, but removed the tab stop. This allows for changing the FSC (for whatever exception that may arise) but requires a deliberate effort on the part of the operator to do so.

    Viewing 1 reply thread
    Reply To: User defined default (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: