Passing the value of ActiveControl to Unbound Text Box

Discussion in 'Access Forms Coding' started by magmike, Jul 16, 2012.

  1. magmike

    magmike Guest

    Similar to the address bar in Excel, I am trying to display the value of the currently entered form field in a Continuous Form in an Unbound Text Box in the Form Header. Here is how I unsuccessfully atempted it:

    In the form's OnCurrent Event:

    Me.FieldValueDisplay.Value = Me.ActiveControl

    What I get on Form Load is an error stating that "The expression you entered requires the Control to be in the active window." After ending the event,tabbing through the fields has no effect, but clicking on them does. Of course, I want the event to work correctly whether clicking into a new field or tabbing into a new field, without having to do an event in each form field (if possible).

    Any ideas?

    Thanks!

    magmike
     
    magmike, Jul 16, 2012
    #1
    1. Advertisements

  2. I haven't time and energy to look it up (taking a last look even though it's
    past my beddybyetime), but isn't ActiveControl a property of the Screen
    object? As coded, you are referring to it as a property of the Form object.

    --
    Larry Linson
    Microsoft Office Access MVP
    Co-Author, Microsoft Access Small Business Solutions, Wiley 2010

    Similar to the address bar in Excel, I am trying to display the value of the
    currently entered form field in a Continuous Form in an Unbound Text Box in
    the Form Header. Here is how I unsuccessfully atempted it:

    In the form's OnCurrent Event:

    Me.FieldValueDisplay.Value = Me.ActiveControl

    What I get on Form Load is an error stating that "The expression you entered
    requires the Control to be in the active window." After ending the event,
    tabbing through the fields has no effect, but clicking on them does. Of
    course, I want the event to work correctly whether clicking into a new field
    or tabbing into a new field, without having to do an event in each form
    field (if possible).

    Any ideas?

    Thanks!

    magmike
     
    Access Developer, Jul 16, 2012
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.