|
-
Dec 7th, 2001, 02:15 PM
#1
Thread Starter
Lively Member
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.
-
Dec 7th, 2001, 02:16 PM
#2
Dump the results off to another variable, then parse the portion that you want to show, and just display that.
-
Dec 7th, 2001, 02:20 PM
#3
Thread Starter
Lively Member
Show me how, would you. Thanks
-
Dec 7th, 2001, 02:28 PM
#4
try something like this
VB Code:
'global declarations
Dim data() As String
'-----------
cboCandName.Clear
x = 0
Do While Not records.EOF
cboCandName.AddItem records.Fields("AIZLTX").Value
Redim preserve data(x)
data(x) = "(" & records.Fields("AIBSCD").Value & " " & records.Fields("AIA8TX").Value & " " & records.Fields("AIDRCD").Value & " " & records.Fields("AIB2NB").Value & ")"
x = x + 1
records.MoveNext
cboCandName.ListIndex = 0
Loop
' to recall other data
'on cbo click event for example put this
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"
-
Dec 7th, 2001, 04:16 PM
#5
Thread Starter
Lively Member
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.
-
Dec 10th, 2001, 11:06 AM
#6
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|