Assign textbox Default Value to another textbox in Forms

Anonymous
2021-04-24T22:52:10+00:00

Hi,

I work as data entry and I have a lot of papers needs to be done, so I am trying to make my work smart as much as I can,

I have Form link to a Document table, and I have for example 2 fields I want to make default value textbox for them, this will helps me a lot becuse I do not want to repeat write them again and again, so plz help me to link this default value textbox with another fildes

txtBoxNum Link to  txtBoxDefultValue

txtBoxFolderNum Link to txtFolderDefaultValue

Kindly, use Expression Builder or Macros or Query

I will show you what I did but it does not work, I open the [Box Number] proprieties and in Default value expression builder I typed

=txtBoxDefultValue

[Folder Number] proprieties

=txtFolderDefaultValue

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. ScottGem 68,780 Reputation points Volunteer Moderator
    2021-04-25T18:23:50+00:00

    You need to use the Set Value Macro Action. In the property dialog select the OnCurrent event and then open the Macro Builder. Make sure you select to show All Actions. Then select the Set Value action. In the Item box type the name of the control you want to assign a value to. Then in the expression box select the control you are pulling the value from. 

    Ex:

    Set Value

    Item = [City]

    Expression = [DefaultCity]

    1 person found this answer helpful.
    0 comments No comments
Answer accepted by question author
  1. DBG 11,531 Reputation points Volunteer Moderator
    2021-04-25T14:48:44+00:00

    Hi

    Ok do it in VBA and I will try to do it by Macro

    Plz indeed

    Well, okay, see if this works for you.

    In the AfterUpdate event of txtBoxDefaultValue, try:

    Me.txtBoxNum.DefaultValue = """" & Me.txtBoxDefaultValue & """"

    In the AfterUpdate event of txtFolderDefaultValue, try:

    Me.txtFolderNum.DefaultValue = """" & Me.txtFolderDefaultValue & """"

    Hope that helps...

    1 person found this answer helpful.
    0 comments No comments

10 additional answers

Sort by: Most helpful
  1. ScottGem 68,780 Reputation points Volunteer Moderator
    2021-04-25T16:12:44+00:00

    Unfortunately, I don't think you can do it via a macro, but there may be am alternative.

    First, lets make sure we are on the same page here. I'm guessing what is happening is that you are doing data entry on a bunch of items where some of the data keeps repeating. For example, you might be entering a bunch of addresses from the same city and state so you want to default to that city and state. But you want to change the City and State when you start on the next batch. If that's the case then a macro won't do it. 

    The concept here is that you want to change the default value for the NEXT record to equal the data value in the current record. To make it clear, the Default Value for a control only takes effect when you start a new record. So you enter an address for Boston, MA, then you go to the next record and Boston MA is filled in automatically.

    If that's the case, then a macro won't work because there is no way to set the Default property in a macro. There is a Set Property macro action, but Default is not on the list of properties that can be set. 

    But, as I said, there is a work around. What you can do is put some unbound text boxes on your form (usually in the form header). Then you can use the ON Current event of the form to run a macro that assigns the value in those unbound text boxes to the bound controls on the form.

    0 comments No comments
  2. Anonymous
    2021-04-25T17:11:52+00:00

    Hi Scott 

    Kindly can you show me how to do this kind of Macro that you referred to? I will try it

    I will be appreciated 

    Plz 🙏🏼

    "But, as I said, there is a work around. What you can do is put some unbound text boxes on your form (usually in the form header). Then you can use the ON Current event of the form to run a macro that assigns the value in those unbound text boxes to the bound controls on the form."

    0 comments No comments
  3. Anonymous
    2021-04-25T17:12:55+00:00

    Thanks indeed!

    0 comments No comments