Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How do I update a text box using a combo box?

Discussion in 'Information Technology' started by Rhoda Harris, Jul 28, 2006.

  1. Rhoda Harris

    Rhoda Harris
    Expand Collapse
    Guest

    Let me start off by saying I am using Access 2000 and am not a programmer;-)
    having said that:

    I have two tables: Mediator and Mediation information. The Mediator table
    has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation table
    has
    Mediator_Name, Mediation_Location, and Mediation_Time.

    I am using a combo box to list the mediator names and have the work phone
    numbers as column 2. What I am trying to do is have a text box show the
    phone number for the mediator chosen from the the combo box. I've tried
    putting this in the AfterUpdate in the text box and get a #Name! error:

    Me!Mediator_Phone = Me![Mediator_Name].Column(2)

    I'm sure the fix is very simple..please help!
     
  2. Loading...


  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    The Column property is zero-based, so Column(0) is the first column,
    Column(1) is the second column, and Column(2) would be the third column,
    which if I understand correctly does not exist in this instance.

    Again, if I understand correctly, I believe this code belongs in the After
    Update event of the combo box rather than of the text box - but perhaps that
    is what you meant to write?

    --
    Brendan Reynolds
    Access MVP


    "Rhoda Harris" <RhodaHarris@discussions.microsoft.com> wrote in message
    news:B975C6E8-9F98-4E37-9528-080C5CFDB2F5@microsoft.com...
    > Let me start off by saying I am using Access 2000 and am not a
    > programmer;-)
    > having said that:
    >
    > I have two tables: Mediator and Mediation information. The Mediator
    > table
    > has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation
    > table
    > has
    > Mediator_Name, Mediation_Location, and Mediation_Time.
    >
    > I am using a combo box to list the mediator names and have the work phone
    > numbers as column 2. What I am trying to do is have a text box show the
    > phone number for the mediator chosen from the the combo box. I've tried
    > putting this in the AfterUpdate in the text box and get a #Name! error:
    >
    > Me!Mediator_Phone = Me![Mediator_Name].Column(2)
    >
    > I'm sure the fix is very simple..please help!
     
  4. Cilla

    Cilla
    Expand Collapse
    Guest

    Rhoda Harris wrote:
    > Let me start off by saying I am using Access 2000 and am not a programmer;-)
    > having said that:
    >
    > I have two tables: Mediator and Mediation information. The Mediator table
    > has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation table
    > has
    > Mediator_Name, Mediation_Location, and Mediation_Time.
    >
    > I am using a combo box to list the mediator names and have the work phone
    > numbers as column 2. What I am trying to do is have a text box show the
    > phone number for the mediator chosen from the the combo box. I've tried
    > putting this in the AfterUpdate in the text box and get a #Name! error:
    >
    > Me!Mediator_Phone = Me![Mediator_Name].Column(2)
    >
    > I'm sure the fix is very simple..please help!


    I would use the dlookup function on the form.

    example:
    Me!Mediator_Phone = DLookup("[Mediator_Phone]" , "Mediator",
    "[Mediator_Name] = Forms![FORMNAME]![Mediator_Name]" )
     
  5. Rhoda Harris

    Rhoda Harris
    Expand Collapse
    Guest

    I get the error message "Run time error'4838' Object doesn't support this
    property or method". I put this code ...Me!Mediator_Phone =
    Me![Mediator_Name].Column(1) in the AfterUpdate event for the combo box.
    Did I type it wrong? Should the bext box be bound to Mediator_Phone? I
    tried that, and it still didn't help. Thanks a ml!
    "Brendan Reynolds" wrote:

    > The Column property is zero-based, so Column(0) is the first column,
    > Column(1) is the second column, and Column(2) would be the third column,
    > which if I understand correctly does not exist in this instance.
    >
    > Again, if I understand correctly, I believe this code belongs in the After
    > Update event of the combo box rather than of the text box - but perhaps that
    > is what you meant to write?
    >
    > --
    > Brendan Reynolds
    > Access MVP
    >
    >
    > "Rhoda Harris" <RhodaHarris@discussions.microsoft.com> wrote in message
    > news:B975C6E8-9F98-4E37-9528-080C5CFDB2F5@microsoft.com...
    > > Let me start off by saying I am using Access 2000 and am not a
    > > programmer;-)
    > > having said that:
    > >
    > > I have two tables: Mediator and Mediation information. The Mediator
    > > table
    > > has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation
    > > table
    > > has
    > > Mediator_Name, Mediation_Location, and Mediation_Time.
    > >
    > > I am using a combo box to list the mediator names and have the work phone
    > > numbers as column 2. What I am trying to do is have a text box show the
    > > phone number for the mediator chosen from the the combo box. I've tried
    > > putting this in the AfterUpdate in the text box and get a #Name! error:
    > >
    > > Me!Mediator_Phone = Me![Mediator_Name].Column(2)
    > >
    > > I'm sure the fix is very simple..please help!

    >
    >
    >
     
  6. Rhoda Harris

    Rhoda Harris
    Expand Collapse
    Guest

    Sounds good .. where does this go? In the form's properties?

    "Cilla" wrote:

    >
    > Rhoda Harris wrote:
    > > Let me start off by saying I am using Access 2000 and am not a programmer;-)
    > > having said that:
    > >
    > > I have two tables: Mediator and Mediation information. The Mediator table
    > > has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation table
    > > has
    > > Mediator_Name, Mediation_Location, and Mediation_Time.
    > >
    > > I am using a combo box to list the mediator names and have the work phone
    > > numbers as column 2. What I am trying to do is have a text box show the
    > > phone number for the mediator chosen from the the combo box. I've tried
    > > putting this in the AfterUpdate in the text box and get a #Name! error:
    > >
    > > Me!Mediator_Phone = Me![Mediator_Name].Column(2)
    > >
    > > I'm sure the fix is very simple..please help!

    >
    > I would use the dlookup function on the form.
    >
    > example:
    > Me!Mediator_Phone = DLookup("[Mediator_Phone]" , "Mediator",
    > "[Mediator_Name] = Forms![FORMNAME]![Mediator_Name]" )
    >
    >
     
  7. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    There's nothing visibly incorrect about what you posted. If 'Mediator_Name'
    is both the name of the combo box and the name of a field in the form's
    record source, though, that might be a possible source of confusion. Try
    changing the name of the combo box, and then changing the code to use the
    new name.

    --
    Brendan Reynolds
    Access MVP


    "Rhoda Harris" <RhodaHarris@discussions.microsoft.com> wrote in message
    news:4C58E81C-9937-43DC-B861-31ED81F60187@microsoft.com...
    >I get the error message "Run time error'4838' Object doesn't support this
    > property or method". I put this code ...Me!Mediator_Phone =
    > Me![Mediator_Name].Column(1) in the AfterUpdate event for the combo box.
    > Did I type it wrong? Should the bext box be bound to Mediator_Phone? I
    > tried that, and it still didn't help. Thanks a ml!
    > "Brendan Reynolds" wrote:
    >
    >> The Column property is zero-based, so Column(0) is the first column,
    >> Column(1) is the second column, and Column(2) would be the third column,
    >> which if I understand correctly does not exist in this instance.
    >>
    >> Again, if I understand correctly, I believe this code belongs in the
    >> After
    >> Update event of the combo box rather than of the text box - but perhaps
    >> that
    >> is what you meant to write?
    >>
    >> --
    >> Brendan Reynolds
    >> Access MVP
    >>
    >>
    >> "Rhoda Harris" <RhodaHarris@discussions.microsoft.com> wrote in message
    >> news:B975C6E8-9F98-4E37-9528-080C5CFDB2F5@microsoft.com...
    >> > Let me start off by saying I am using Access 2000 and am not a
    >> > programmer;-)
    >> > having said that:
    >> >
    >> > I have two tables: Mediator and Mediation information. The Mediator
    >> > table
    >> > has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation
    >> > table
    >> > has
    >> > Mediator_Name, Mediation_Location, and Mediation_Time.
    >> >
    >> > I am using a combo box to list the mediator names and have the work
    >> > phone
    >> > numbers as column 2. What I am trying to do is have a text box show
    >> > the
    >> > phone number for the mediator chosen from the the combo box. I've tried
    >> > putting this in the AfterUpdate in the text box and get a #Name! error:
    >> >
    >> > Me!Mediator_Phone = Me![Mediator_Name].Column(2)
    >> >
    >> > I'm sure the fix is very simple..please help!

    >>
    >>
    >>
     
  8. Rhoda Harris

    Rhoda Harris
    Expand Collapse
    Guest

    That worked! Thanks a mil ...

    "Brendan Reynolds" wrote:

    >
    > There's nothing visibly incorrect about what you posted. If 'Mediator_Name'
    > is both the name of the combo box and the name of a field in the form's
    > record source, though, that might be a possible source of confusion. Try
    > changing the name of the combo box, and then changing the code to use the
    > new name.
    >
    > --
    > Brendan Reynolds
    > Access MVP
    >
    >
    > "Rhoda Harris" <RhodaHarris@discussions.microsoft.com> wrote in message
    > news:4C58E81C-9937-43DC-B861-31ED81F60187@microsoft.com...
    > >I get the error message "Run time error'4838' Object doesn't support this
    > > property or method". I put this code ...Me!Mediator_Phone =
    > > Me![Mediator_Name].Column(1) in the AfterUpdate event for the combo box.
    > > Did I type it wrong? Should the bext box be bound to Mediator_Phone? I
    > > tried that, and it still didn't help. Thanks a ml!
    > > "Brendan Reynolds" wrote:
    > >
    > >> The Column property is zero-based, so Column(0) is the first column,
    > >> Column(1) is the second column, and Column(2) would be the third column,
    > >> which if I understand correctly does not exist in this instance.
    > >>
    > >> Again, if I understand correctly, I believe this code belongs in the
    > >> After
    > >> Update event of the combo box rather than of the text box - but perhaps
    > >> that
    > >> is what you meant to write?
    > >>
    > >> --
    > >> Brendan Reynolds
    > >> Access MVP
    > >>
    > >>
    > >> "Rhoda Harris" <RhodaHarris@discussions.microsoft.com> wrote in message
    > >> news:B975C6E8-9F98-4E37-9528-080C5CFDB2F5@microsoft.com...
    > >> > Let me start off by saying I am using Access 2000 and am not a
    > >> > programmer;-)
    > >> > having said that:
    > >> >
    > >> > I have two tables: Mediator and Mediation information. The Mediator
    > >> > table
    > >> > has Mediator_Name, Mediator_Phone, and Mediator_Address. The Mediation
    > >> > table
    > >> > has
    > >> > Mediator_Name, Mediation_Location, and Mediation_Time.
    > >> >
    > >> > I am using a combo box to list the mediator names and have the work
    > >> > phone
    > >> > numbers as column 2. What I am trying to do is have a text box show
    > >> > the
    > >> > phone number for the mediator chosen from the the combo box. I've tried
    > >> > putting this in the AfterUpdate in the text box and get a #Name! error:
    > >> >
    > >> > Me!Mediator_Phone = Me![Mediator_Name].Column(2)
    > >> >
    > >> > I'm sure the fix is very simple..please help!
    > >>
    > >>
    > >>

    >
    >
    >
     

Share This Page