Trim?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have a form based in T_Phrases
This form has cboPhrase.
AfterUpdate combo, show us in textbox the choosed phrase.

I would like to be able to choose one world and show it in another textbox.
Ex: "The word choosed"

If string = 1 Then
The

If string 2 = Then
word

If string =3 Then
choosed

If the phrase has only two words?

On Error Resume Next (?)

Thanks in advance
an
 
You can create a function that except to parameters, the combo value and the
column number, something like

Function splitCombo(ComboValue, ColumnNum)
On Error GoTo splitCombo_err
splitCombo = Split(ComboValue, " ")(ColumnNum)
Exit Function
splitCombo_err:
If err = 9 Then
splitCombo = ""
End If
End Function

In the Text Box ControlSource call the function and specify which word you
want

1:
=splitCombo([ComboName], 0)

2:
=splitCombo([ComboName], 1)

I hope that what you meant
 
Thank you for reply

Return error:
The expression you entered contains invalid sintax.

an

Ofer Cohen said:
You can create a function that except to parameters, the combo value and the
column number, something like

Function splitCombo(ComboValue, ColumnNum)
On Error GoTo splitCombo_err
splitCombo = Split(ComboValue, " ")(ColumnNum)
Exit Function
splitCombo_err:
If err = 9 Then
splitCombo = ""
End If
End Function

In the Text Box ControlSource call the function and specify which word you
want

1:
=splitCombo([ComboName], 0)

2:
=splitCombo([ComboName], 1)

I hope that what you meant

--
Good Luck
BS"D


an said:
Hi!

I have a form based in T_Phrases
This form has cboPhrase.
AfterUpdate combo, show us in textbox the choosed phrase.

I would like to be able to choose one world and show it in another textbox.
Ex: "The word choosed"

If string = 1 Then
The

If string 2 = Then
word

If string =3 Then
choosed

If the phrase has only two words?

On Error Resume Next (?)

Thanks in advance
an
 
In which line the error occur? (press Ctrl+Break when the error message)

When using
=splitCombo([ComboName], 1)
You need to change ComboName to your combo name

Also, try to define the variable
Function splitCombo(ComboValue As String, ColumnNum As Integer)
On Error GoTo splitCombo_err
splitCombo = Split(ComboValue, " ")(ColumnNum)
Exit Function
splitCombo_err:
If err = 9 Then
splitCombo = ""
End If
End Function

--
Good Luck
BS"D


an said:
Thank you for reply

Return error:
The expression you entered contains invalid sintax.

an

Ofer Cohen said:
You can create a function that except to parameters, the combo value and the
column number, something like

Function splitCombo(ComboValue, ColumnNum)
On Error GoTo splitCombo_err
splitCombo = Split(ComboValue, " ")(ColumnNum)
Exit Function
splitCombo_err:
If err = 9 Then
splitCombo = ""
End If
End Function

In the Text Box ControlSource call the function and specify which word you
want

1:
=splitCombo([ComboName], 0)

2:
=splitCombo([ComboName], 1)

I hope that what you meant

--
Good Luck
BS"D


an said:
Hi!

I have a form based in T_Phrases
This form has cboPhrase.
AfterUpdate combo, show us in textbox the choosed phrase.

I would like to be able to choose one world and show it in another textbox.
Ex: "The word choosed"

If string = 1 Then
The

If string 2 = Then
word

If string =3 Then
choosed

If the phrase has only two words?

On Error Resume Next (?)

Thanks in advance
an
 
- In which line the error occur?
R: The error occur after write
=splitCombo([cboPhrase], 1)
in the Text Box ControlSource

- The combo name was changed (cboPhrase).

- With new code doesn't work too.

Thanks.
an

Ofer Cohen said:
In which line the error occur? (press Ctrl+Break when the error message)

When using
=splitCombo([ComboName], 1)
You need to change ComboName to your combo name

Also, try to define the variable
Function splitCombo(ComboValue As String, ColumnNum As Integer)
On Error GoTo splitCombo_err
splitCombo = Split(ComboValue, " ")(ColumnNum)
Exit Function
splitCombo_err:
If err = 9 Then
splitCombo = ""
End If
End Function

--
Good Luck
BS"D


an said:
Thank you for reply

Return error:
The expression you entered contains invalid sintax.

an

Ofer Cohen said:
You can create a function that except to parameters, the combo value and the
column number, something like

Function splitCombo(ComboValue, ColumnNum)
On Error GoTo splitCombo_err
splitCombo = Split(ComboValue, " ")(ColumnNum)
Exit Function
splitCombo_err:
If err = 9 Then
splitCombo = ""
End If
End Function

In the Text Box ControlSource call the function and specify which word you
want

1:
=splitCombo([ComboName], 0)

2:
=splitCombo([ComboName], 1)

I hope that what you meant

--
Good Luck
BS"D


:

Hi!

I have a form based in T_Phrases
This form has cboPhrase.
AfterUpdate combo, show us in textbox the choosed phrase.

I would like to be able to choose one world and show it in another textbox.
Ex: "The word choosed"

If string = 1 Then
The

If string 2 = Then
word

If string =3 Then
choosed

If the phrase has only two words?

On Error Resume Next (?)

Thanks in advance
an
 
Back
Top