Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: String information from Combo Box


Message #1 by "KennethMungwira" <KennethMungwira@y...> on Wed, 19 Feb 2003 20:28:10
 In my access input form I have a Combo Pull Down Box which returns these 
items. I would like to take the result of line and place it in a Text Box
(Text1). Unfortunately, the "-" spacer make is hard to actually count 
line spaces since all the lines a different

SELECT [ID] & "-" & [From] & "-" & [FrName] & "-" & [To] & "-" & [ToName] 
& "-" & [TokV] & "-" & [Ckt] & "-" & [InYr] 

Eg, output of CboLimiting(Pull Down)

1-KLONDIKE-3-NORCROSS-500-1-0-S
204-FULTON-4-ROAD-70-3-9-F

The code below shows Text Box = KLONDIKE , but if I pick the second line 
TextBox Shows = 4-FULTON

Private Sub CboLimiting_Change()
    Dim AnyString, MyStr
    AnyString = CboLimiting.Text    ' Define string.
    MyStr = Mid(AnyString, 3, 8)
    Me.Text1.Value = MyStr
    
End Sub
Message #2 by "Gregory Serrano" <SerranoG@m...> on Thu, 20 Feb 2003 14:13:20
Kenneth,

<< Eg, output of CboLimiting(Pull Down)

1-KLONDIKE-3-NORCROSS-500-1-0-S
204-FULTON-4-ROAD-70-3-9-F

The code below shows Text Box = KLONDIKE , but if I pick the second line 
TextBox Shows = 4-FULTON >>

What exactly do you want to be assigned to Me.Text1?  Do you want 
just "KLONDIKE", "FULTON", etc?  That is, do you want just to assign the 
part between the first and second hyphens?  If so, just make your dropdown 
TWO columns, not one.  The second column is invisible (width = 0) but it 
is the bound column.  In this second column, put the data [From] out of 
the table.

When someone clicks the dropdown, they'll see the long text, but column 
two will only have the words you want.  When you choose something out of 
the combobox:

   Me.Text1 = Me.cboLimiting

Since the bound column is column two, Me.Text1 will get what you want.


Greg

  Return to Index