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. DBG 11,531 Reputation points Volunteer Moderator
    2021-04-25T17:33:41+00:00

    Thanks indeed!

    You're welcome. Let us know how it goes.

    0 comments No comments
  2. Anonymous
    2021-04-25T19:51:47+00:00

    Scottgem,

    WoW It works 👍 , If I click new record the numbers show.

    But I have small problem, if we can fix it

    If I click  next record or back record  those numbers will be inserted over the original data that i enter them before, so how can I say to macro insert default number when I want you to insert them, or maybe you have different solution?

    Thanks!

    0 comments No comments
  3. ScottGem 68,780 Reputation points Volunteer Moderator
    2021-04-25T21:07:00+00:00

    OK, there are a couple of ways to do this. 

    One way would be to enclose each control assignment within an IF Action that tests if the control is Null. If its not Null then don't do the assignment.

    Another possibility is to remove the macro from the On Current event and put it behind a button. Then pressing the button will fill in the controls.

    This is much harder in macros then in VBA.

    0 comments No comments