How do I get my textbox field in my form to automatically enter data based on another textbox in Access 2019?

Arreya Ahrom 1 Reputation point

I'd like to populate a "month" textbox based on an entered "date" textbox. How do I go about doing this?

e.g. I enter "02/02/21" in my "date" textbox and then I press tab to the "month" textbox which will automatically fill in "February". This month would then be saved in its corresponding field in my record source.

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
858 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. DBG 2,301 Reputation points

    Hi. The "month" textbox is a "calculated" value, so there's really no need to store it in the table (it's actually against normalization rules).

    To automatically display the month, you can use something like:


    0 comments No comments

  2. Ken Sheridan 2,756 Reputation points

    Bind the 'month' text box to your date field and make it read only by setting its properties as follows:

    ControlSource: [NameOfYourDateField]
    Format: mmmm
    Enabled: No
    Locked: Yes

    Once a valid date is entered into the date field the month text box will show the corresponding month.

    The month field should be deleted from the table as it is redundant, being determined by the date field, and thus means that the table is not normalized to Third Normal Form (3NF), with the consequent risk of update anomalies.

    0 comments No comments