set the default of a field based on another field RRS feed

  • Question

  • in the form, i have a check box to be checked if an item is selected. Once that is checked, the value of another field should be set to it's default value as a placeholder. its final value will be determined later from the options in the combo box.
    Wednesday, August 22, 2018 6:45 PM

All replies

  • Hi,

    Not sure I understand the complete scenario but to set the Default Value of a control to a value of another control, you could try something like:

    Me.ControName.DefaultValue = """" & Me.OtherControlName & """"

    Hope it helps...

    Wednesday, August 22, 2018 9:17 PM
  • A column's or bound control's DefaultValue property value is assigned to the Value property of a control once the user enters data into any bound control in a form.  If your checkbox is a bound control therefore, you don't need to take any further action.

    If the checkbox is an unbound control then you simply need to set the value of the bound control to itself, e.g. in the check box's AfterUpdate event procedure:

        If Me.[CheckBox Name} = True Then
            Me.[BoundControlName] = Me.[BoundControlName]
        End If

    This will Dirty the form, so when the current record is saved by moving to another record, closing the form or otherwise explicitly saving the record, the value will be committed to the column to which the control is bound.

    Ken Sheridan, Stafford, England

    Thursday, August 23, 2018 11:36 AM