Results 1 to 6 of 6

Thread: hide string

  1. #1

    Thread Starter
    Lively Member Elhassan's Avatar
    Join Date
    Nov 2001
    Location
    Minnesota
    Posts
    79

    hide string

    Hello guys,

    I have a simple question. I'm wondering if I could do a string search and only display part of the result... hiding the rest from the user. I'm displaying the search result in a combo box.

    Something like:

    cboCandName.Clear
    Do While Not records.EOF
    cboCandName.AddItem records.Fields("AIZLTX").Value & " " & "(" & _
    records.Fields("AIBSCD").Value & " " & records.Fields("AIA8TX").Value & " " & _
    records.Fields("AIDRCD").Value & " " & records.Fields("AIB2NB").Value & ")"
    records.MoveNext
    cboCandName.ListIndex = 0
    Loop


    I only want to display whatever "AIZLTX" correponds to. Thanx.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Dump the results off to another variable, then parse the portion that you want to show, and just display that.

  3. #3

    Thread Starter
    Lively Member Elhassan's Avatar
    Join Date
    Nov 2001
    Location
    Minnesota
    Posts
    79
    Show me how, would you. Thanks

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    try something like this


    VB Code:
    1. 'global declarations
    2. Dim data() As String
    3. '-----------
    4. cboCandName.Clear
    5. x = 0
    6. Do While Not records.EOF
    7. cboCandName.AddItem records.Fields("AIZLTX").Value
    8. Redim preserve data(x)
    9. data(x) = "(" & records.Fields("AIBSCD").Value & " " & records.Fields("AIA8TX").Value & " " & records.Fields("AIDRCD").Value & " " & records.Fields("AIB2NB").Value & ")"
    10. x = x + 1
    11. records.MoveNext
    12. cboCandName.ListIndex = 0
    13. Loop
    14.  
    15. ' to recall other data
    16. 'on cbo click event for example put this
    17. Msgbox cboCandName.text & " " & data(cboCandName.listindex)


    see if that works
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    Lively Member Elhassan's Avatar
    Join Date
    Nov 2001
    Location
    Minnesota
    Posts
    79
    Still looking for an answer guys.....

    Thanks geoff_xrx and Hack, you guys are wonderful. It worked fine. Now the part which I'm not displaying is the following:


    ReDim Preserve Data(x)
    Data(x) = records.Fields("geocode").Value
    x = x + 1

    The "geocode" is a primary key in a database. My question is can I use or pass it to let say cboCandName_Change or cboCand_Click to bring up say a map. This is the whole idea behind doing this search. Thanks a mill.
    Last edited by Elhassan; Dec 10th, 2001 at 09:02 AM.

  6. #6

    Thread Starter
    Lively Member Elhassan's Avatar
    Join Date
    Nov 2001
    Location
    Minnesota
    Posts
    79
    Hey Hach, what's up?

    Forget about the map and let us concentrate on the following. I do a subroutine that goes like this:

    Private Sub SearchGeocode()

    Dim expGeocode As String

    expGeocode = "geocode = '" & txtGeocode.Text & " '"
    Set records = Map1.Layers("prclplgn").SearchExpression(expGeocode

    End Sub

    If the string I'm displaying (check the previous posts above) in the combo box has a part that the use does not see (hidden) which is called "geocode" which is a pk in the database. My question is can I pass just that part and not the whole string in this case it is data(x) to the SearchGeocde subroutine?, and how?

Posting Permissions

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



Click Here to Expand Forum to Full Width