Results 1 to 7 of 7
  1. #1
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85

    Setting a default value to another value

    Can you set a default value to another field value in the same table? How would you do that if so?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,925
    Why not just try it and see? Should not take long?
    You can in a form though?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    Should clarify what you mean by "default value" as it has a specific meaning. If a user enters a value in a form control, the default is inconsequential (assuming you've set that property for the control). If they don't enter a value then update the control or the record, then the default is written to the field. If that happens and you want to change the value later, it is a simple update query.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,420
    also clarify if you mean in a table, or dynamically in a form. Suggest provide some example data

  5. #5
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,043
    The default value = value that will be filled in when starting a new, empty record. When starting a new, empty record, all fields are empty, so it has no sense to set the default to another empty field. What you can do is create a calculated field in the table, but then that field cannot be manually changed and will always depend on the value of the other field.
    What you can do, as Welshman said, is add code to a form that will fill in the value of field1 in field2, when field2 is empty.
    Last edited by NoellaG; 06-25-2022 at 04:09 AM. Reason: typo

  6. #6
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85
    Thank you all for your ideas. Before I posted this original thread, I simply added in the field name of the field I wanted the current field to default to but that didn't work. Thus, I wasn't sure if it was possible to set the default value of a field to a value in another field in the same table. NoellaG's point makes a lot of sense as there is no value in those other fields until such time a value is entered for the particular record. While I wasn't able to tie a default value of one field in a record to another field's value in the same record, I figured out another way to achieve my desired result. I am often restricted by my work from sharing portions of the actual dbase here so I really appreciate your help even without a visual of what I was doing. Thank you.

  7. #7
    Join Date
    Jun 2022
    Posts
    4
    You can use a Calculated field type. This is intended for using other fields in the same record for calculations like adding sales tax for example, but you can use it simply to duplicate a value from another field. Just enter the field name as the Expression.

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

Similar Threads

  1. Default font setting
    By Perfac in forum Forms
    Replies: 3
    Last Post: 12-03-2018, 08:38 AM
  2. Setting default with an IIF Function
    By cptdave1996 in forum Access
    Replies: 14
    Last Post: 12-14-2015, 01:57 PM
  3. Setting default
    By Thompyt in forum Programming
    Replies: 10
    Last Post: 11-10-2014, 11:49 AM
  4. Setting default value to zero in form box?
    By dekhelia in forum Forms
    Replies: 6
    Last Post: 10-17-2013, 08:53 AM
  5. Setting default vaulue?
    By djclntn in forum Forms
    Replies: 17
    Last Post: 04-12-2012, 11:20 PM

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