DataCombing - Rensning & Konvertering af data
Option Compare DatabaseOption Explicit
Public GamNR As String
Public NytNR As Long
Public Function RemSpace(Value As Variant) As Variant
If Not IsNull(Value) Then RemSpace = Replace(Value, \" \", \"\")
End Function
Public Function RemDot(Value As Variant) As Variant
If Not IsNull(Value) Then RemDot = Replace(Value, \".\", \"\")
End Function
Public Function TekstTilInt(Value As Variant) As Variant
If Not IsNull(Value) Then
GamNR = Value
RemSpace (GamNR)
Debug.Print GamNR
RemDot (GamNR)
Debug.Print GamNR
NytNR = CLng(Left(GamNR, 8))
TekstTilInt = NytNR
End If
End Function
###
Hvorfor er det lige at RemSpace & RemDot ikke bliver afviklet ? Ud fra mine debugdata kan
jeg se at de to funktioner aldrig får behandlet variablen GamNR. Koden fungerer ellers
fint, bortset fra et en string med 1 eller flere \" \" i, skaber en type mismatch når jeg
prøvet at konvertere til LongInteger
