Copy value of one field to another on Access Form

Posted on 2011-05-03
Last Modified: 2012-05-11
I need to copy the value of one field into another from an access form but i keep getting an error about setting focus:

Me!Q2_COMP_BY.Text = UCase(Me!Q1_COMP_BY.Text)
Question by:shelbyinfotech
    LVL 75

    Accepted Solution

    Remove the .Text property.

    Me!Q2_COMP_BY= UCase(Me!Q1_COMP_BY)
    LVL 12

    Expert Comment

    Try to use this statement instead;
    Me!Q2_COMP_BY = UCase(Me!Q1_COMP_BY)

    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    Looks like you are coming from the VB community, where the Text property is the default.

    In Access you can only use the "Text" property when refering to the control that has the focus.  So, if Q2_Comp_By has the focus, you could use:

    me.Q2_Comp_By.text = UCASE(me.Q1_Comp_By.Value)

    or you could drop the Value, since it is the default,

    me.Q2_Comp_By = UCASE(me.Q1.Comp_By)
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    That's what I get for providing an explaination!
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    OR ... set Focus to the control first - if you need to reference the Text property:

    Me.Q2_COMP_BY.Text = UCase(Me.Q1_COMP_BY.Text)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now