Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: CountyLong Name and County Short Name

    Hello, i have database front end is Access, and backend is sql server. The front end, there are two dropbox, called 'CountyLongName', and 'CountyShortName'. I want to: when i select a countyLongName, there it will pop up the exact CountyShortName in anohter field.

    For example, when i click Howard Couty in the 'CountyLongNmae', it will automatically display "HW" in the 'CountyShortName" Field. How can i do that? Thanks.

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    More of an Access question than an SQL question. Also, more of a front-end question than a db question.

    That said, the drop-down list has an event called OnChange. In the code for that event, will be something like:

    Code:
    text1.Value = lkpCountyShortName.Column(1)
    You must define the query for the lkpCountyShortName to include 2 columns, the first being the short name and the second being the long name.

    Regards,

    hmscott

    Quote Originally Posted by yyu
    Hello, i have database front end is Access, and backend is sql server. The front end, there are two dropbox, called 'CountyLongName', and 'CountyShortName'. I want to: when i select a countyLongName, there it will pop up the exact CountyShortName in anohter field.

    For example, when i click Howard Couty in the 'CountyLongNmae', it will automatically display "HW" in the 'CountyShortName" Field. How can i do that? Thanks.
    Have you hugged your backup today?

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    I usually Dim an array that contains the CountyShortName and populate it in the same loop where I populate the drop-down list. This way the subscript value for each combobox element is the same as the array subscript.

    txtShortName.Text = ShortNames_A(cmbLongNames.ListIndex)
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Mar 2004
    Posts
    660
    Thanks your guy still remembered me. Last time the backup problem made me crazy. Fortunately everything was recovered.
    Do you have any code I can reference,thanks in advance. I am not familar with VBA. I have counties,

    Allegany AL
    Anne Arundel AA
    Baltimore City BC
    Baltimore County BA
    Calvert CV
    Caroline CA
    Carroll CR
    Cecil CE
    Charles CH
    Dorchester DO
    Frederick FR
    Garrett GA
    Harford HA
    Howard HO
    Kent KE
    Montgomery MO
    Prince George PG
    Queen Anne QA
    Saint Mary SM
    Somerset SO
    Talbot TA
    Washington WA
    Wicomico WI
    Worcester -- WO

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Make the Datasource look like

    SELECT CountyLongName + ' - ' + CountyShortName FROM yourTable

    ?????????????
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Mar 2004
    Posts
    660
    I am so sorry, i am still can't figure out how to do it. Can you guy give me more detail. Now i already have a file call "CountyLongName" and CountyShortName". Thanks again!

Posting Permissions

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