Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Dec 2002
    Location
    New Orleans, Louisiana, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update field from combo box (Access2000)

    I do this everytime I create a database (all 2 of them) and I don't know why I can't get it right. I want my combo box for PlanCode to automatically update the PlanName field. I have the following:
    combo box
    Name:PlanCode
    Control source:PlanCode
    RowSource:SELECT [L_Plans].[PlanCode],[L_Plans].[PlanName] FROM L_Plans;
    Column Count: 1
    Bound Column: 1

    After Update Event is coded:
    Option Compare Database

    Private Sub PlanCode_AfterUpdate()
    Me![PlanName]=Me![PlanCode].Column(1)
    End Sub


    I don't get an error message when I select a PlanCode but the PlanName field remains blank.

    Thanks for the help in advance,
    Laura

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: update field from combo box (Access2000)

    You problem is "Column Count: 1". It should be 2!
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Star Lounger
    Join Date
    Dec 2002
    Location
    New Orleans, Louisiana, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update field from combo box (Access2000)

    Still doesn't work. That gives me two columns in the column count. I want the PlanName in a separate field, in a text box.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: update field from combo box (Access2000)

    Mark is right - you should set the Column Count property of the combo box to 2. If you want to display only one column in the list part of the combo box, set the column widths to appropriate values - use 0 to hide a column.

    If Column Count is 1, the combo box doesn't "see" a second column, even if it is present in the row source. It will set the text box to null (empty) in the AfterUpdate event.

  5. #5
    Star Lounger
    Join Date
    Dec 2002
    Location
    New Orleans, Louisiana, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update field from combo box (Access2000)

    If I do what Mark suggested, I get two columns in my combo box. I want the PlanName to actually show up in a different place on the form. I did it in my two other databases and there is some little thing I'm not doing but I can't figure out what it is.

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: update field from combo box (Access2000)

    Can't you use the combo box wizard to create the combo box? After using the wizard go into properties and see what you are forgetting.
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  7. #7
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: update field from combo box (Access2000)

    Then set the width of the 2nd column to 0". You have to have 2 columns (even if you can't see them) if you want to use the .column(1) property.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  8. #8
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: update field from combo box (Access2000)

    Hi Mark,
    It has been solved in the other thread, you may as well close off this thread.
    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •