Results 1 to 8 of 8
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    User defined default (2000)

    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!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User defined default (2000)

    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.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: User defined default (2000)

    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).

  4. #4
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: User defined default (2000)

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

    Thanks!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  5. #5
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: User defined default (2000)

    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
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  6. #6
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: User defined default (2000)

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

    Bryan
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  7. #7
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: User defined default (2000)

    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
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

  8. #8
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: User defined default (2000)

    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.
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •