String value

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
 
C

Chuck Minarik

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
 
D

Dirk Goldgar

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.
 
D

Dutchy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top