Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    New Jersey, USA
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    column from 1 column box filling another (97 sr2)

    I have been trying in vain to have the data in column(1) of a combo box fill in another combo box(or text box for that matter) on a form. I have a combo box with 2 columns - 1 for town and the second for county. Since there can be more than 1 town with the same name in the state I have to attach the county to the source record as well as town.. I would like the county field to be the result of the choice in the combo, since the combo table has each town and county in its two fields. I hope someone can follow this. I am going crazy trying so many different ideas. I would be willing to do it as an update query that is run with the push of a button if need be, but I can't get to the data in the second column. HELP!!!!!!!

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: column from 1 column box filling another (97 sr2)

    To place the county in a textbox on the form, on an Event (I used OnExit for an example) of the Town combobox, place the following code:

    <pre>Private Sub Town_Exit(Cancel As Integer)

    If Not IsNull(Me![Town]) Then
    Me![County] = Me![Town].Column(1)
    Else
    MsgBox ("Please select a Town from the dropdown box")
    End If

    End Sub</pre>


    The example uses Town as the name of the combobox and County as the name of the textbox. You will need to change them to your own names. HTH

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: column from 1 column box filling another (97 sr2)

    Actually, I think the AfterUpdate event of the combobox would be a better choice than OnExit. AfterUpdate will occur even if the combobox doesn't lose the focus.
    Charlotte

  4. #4
    2 Star Lounger
    Join Date
    Aug 2002
    Location
    New Jersey, USA
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: column from 1 column box filling another (97 sr2)

    Thanks, I am finally getting somewhere.

Posting Permissions

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