From: Peter Marshall on
I'm looking for a simple way to check that the text entered into a text box
contains a slash at the end. I'm assuming VBA that executes On_Exit.

--

Peter Marshall
Manager Information Services
Ohio Coatings Company


From: Tom van Stiphout on
On Mon, 8 Mar 2010 08:30:18 -0500, "Peter Marshall"
<peter.marshall(a)ohiocoatingscompany.com> wrote:

if right$(Me.myTextBox,1) = "/" then
'yes it does
else
'no it doesn't
end if

-Tom.
Microsoft Access MVP



>I'm looking for a simple way to check that the text entered into a text box
>contains a slash at the end. I'm assuming VBA that executes On_Exit.
From: Peter Marshall on
Thank you, Tom.

--

Peter Marshall
Manager Information Services
Ohio Coatings Company
"Tom van Stiphout" <tom7744.no.spam(a)cox.net> wrote in message
news:gbv9p5dn11cktq8tu55oufq2285722ib10(a)4ax.com...
> On Mon, 8 Mar 2010 08:30:18 -0500, "Peter Marshall"
> <peter.marshall(a)ohiocoatingscompany.com> wrote:
>
> if right$(Me.myTextBox,1) = "/" then
> 'yes it does
> else
> 'no it doesn't
> end if
>
> -Tom.
> Microsoft Access MVP
>
>
>
>>I'm looking for a simple way to check that the text entered into a text
>>box
>>contains a slash at the end. I'm assuming VBA that executes On_Exit.


From: Jon Lewis on
Private Sub Text1_Exit(Cancel As Integer)
If Not Right(Me.Text1, 1) = "/" Then
Cancel = True
MsgBox "No '/'", vbExclamation
End If
End Sub


"Peter Marshall" <peter.marshall(a)ohiocoatingscompany.com> wrote in message
news:OIkr$NsvKHA.5036(a)TK2MSFTNGP02.phx.gbl...
> I'm looking for a simple way to check that the text entered into a text
> box contains a slash at the end. I'm assuming VBA that executes On_Exit.
>
> --
>
> Peter Marshall
> Manager Information Services
> Ohio Coatings Company
>


From: Stefan Hoffmann on
hi Peter,

On 08.03.2010 14:30, Peter Marshall wrote:
> I'm looking for a simple way to check that the text entered into a text box
> contains a slash at the end. I'm assuming VBA that executes On_Exit.
You may use a input mask or use this in your event:

Const COLOR_LIGHTBLUE As Long = 15713933
Const COLOR_WHITE As Long = 16777215

Dim length As Long

length = Len(Trim(Nz(txtYourControl.Value, "")))
If (length > 0) And _
(Mid(txtYourControl.Value, length, 1) <> "-") Then
txtYourControl.BackColor = COLOR_LIGHTBLUE
Else
txtYourControl.BackColor = COLOR_WHITE
End If

btw, I would use the On Change event.


mfG
--> stefan <--