String value

  • Thread starter Thread starter Dutchy
  • Start date Start date
D

Dutchy

Hi,

Hope somebody can help me with this problem

Private Sub lidnummer_AfterUpdate()
Dim tussenstap As String
On Error GoTo einde
If Left(Me!combo6, 11) = "DE VOORZORG " Then
tussenstap = Right(Me!lidnummer, 6)
If Right(tussenstap, 2) < 10 Then
Me!geboortedatum = Left(tussenstap, 2) & "/" & Mid(tussenstap, 3, 2) &
"/20" & Right(tussenstap, 2)
Else
Me!geboortedatum = Left(tussenstap, 2) & "/" & Mid(tussenstap, 3, 2) &
"/19" & Right(tussenstap, 2)
End If
End If

I can not get the value of Right(Me!lidnummer, 6) into the string variable
"tussenstap"
When I run the code and put a stop to check the values Me!lidnummer has a
value but tussenstap is empty ("")
How is this possible??
Thanks for your kind help
JP
 
I don't know how you've got lidnummer defined, but it
probably has trailing blanks. See if this doesn't help:

tussenstap = Right(Trim$(Me!lidnummer), 6)

Chuck
 
Dutchy said:
Hi,

Hope somebody can help me with this problem

Private Sub lidnummer_AfterUpdate()
Dim tussenstap As String
On Error GoTo einde
If Left(Me!combo6, 11) = "DE VOORZORG " Then
tussenstap = Right(Me!lidnummer, 6)
If Right(tussenstap, 2) < 10 Then
Me!geboortedatum = Left(tussenstap, 2) & "/" & Mid(tussenstap, 3,
2) & "/20" & Right(tussenstap, 2)
Else
Me!geboortedatum = Left(tussenstap, 2) & "/" & Mid(tussenstap, 3,
2) & "/19" & Right(tussenstap, 2)
End If
End If

I can not get the value of Right(Me!lidnummer, 6) into the string
variable "tussenstap"
When I run the code and put a stop to check the values Me!lidnummer
has a value but tussenstap is empty ("")
How is this possible??
Thanks for your kind help
JP

Where did you put your breakpoint? I suggest put a breakpoint at the
top of the prcedure, then step through the code a line at a time using
F8 to make sure this If statement --
If Left(Me!combo6, 11) = "DE VOORZORG " Then

-- evaluates to True and execution proceeds to this statement:
tussenstap = Right(Me!lidnummer, 6)

I don't see how that statement can fail to assign the value properly, so
I'm guessing either the If statement is False or an error is being
raised before the value is assigned.
 
Problem is solved..
The problem was in the line:

If Left(Me!combo6, 11) = "DE VOORZORG " Then

the far most richt character seemed to be a blank character, so indeed the
if statement never was true...
How stupid..
Thanks
JP
 
Back
Top