Results 1 to 4 of 4
  1. #1
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112

    Can I use form to reset a field's default value in a table

    Hello,


    I have a table with several default values (Semester and Year).
    In the transition to the next semester/year, the user will delete the rows of several tables but maintain the table structure, ready for the new data entry in the next semester.

    Is there a way to create a form that asks the user to enter the new semester and year -- and then have those values become the new default values of the fields (to be applied when new records are created.) (I don't want to ask that the person go into the design view of the table itself. I am hoping to do this with a form.)

    Any suggestions?
    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    don't set defaults on the table, set them on the form
    (for just this reason)

  3. #3
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112
    Well... I know that makes sense, but I have dozens of forms that would have to have this field added one way or the other, and the change only occurs twice a year.

    Are there any other options?
    Thanks

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    you may set the default in your table - and every form control you create after you have done this will pick the default. However controls that existed before you set or change the default will not be affected. So as ranman says, better to just set it in the form

    Is there a way to create a form that asks the user to enter the new semester and year -- and then have those values become the new default values of the fields
    whatever you do means going into all your forms and modifying them

    To modify only once, what you can do is have a table of defaults. suggest needs fields tablename, fieldname and default value

    so have a form for a user to update this

    then in each form open event you need some code to lookup the default value and assign it to the relevant control

    e.g. acontrol.defaultvalue=dlookup("default","tbldefaul ts","tablename='tblsomething' AND fieldname='" & acontrol.name & "'")

    alternatively, perhaps the default can be set based on a calculation - you mention semester and year - can these be determined by a calculation based on the date function? If so - calculate and set it when the form is opened

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Reset to default printer after printing labels
    By chromachem in forum Programming
    Replies: 6
    Last Post: 02-26-2016, 11:23 AM
  2. Reset ONE SINGLE Text Box to it's Default Value
    By mrmims in forum Programming
    Replies: 1
    Last Post: 07-18-2015, 02:47 AM
  3. Set table.field default from a form.
    By Thompyt in forum Access
    Replies: 6
    Last Post: 10-30-2014, 02:47 PM
  4. Replies: 5
    Last Post: 07-07-2014, 12:00 PM
  5. Reset Combo Box to Default Value After One Hour
    By athyeh in forum Programming
    Replies: 3
    Last Post: 08-14-2013, 10:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums