RgExp.Pattern (1 Viewer)

hardy1976

Still learning...
Local time
Today, 10:42
Joined
Apr 27, 2006
Messages
200
Got it thank you all for your help
"^\d{11}\/[a-zA-Z0-9]{4}\d{4}|^\d{11}\/\d{8}$"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:42
Joined
Oct 29, 2018
Messages
21,449
Got it thank you all for your help
"^\d{11}\/[a-zA-Z0-9]{4}\d{4}|^\d{11}\/\d{8}$"
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

hardy1976

Still learning...
Local time
Today, 10:42
Joined
Apr 27, 2006
Messages
200
LOL - yes it was...

Well the expressions I posted worked on the test site I linked to?

Plus, what is TestDate doing?

Is your code even doing what you think it should be doing?

Code:
Dim rst As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * from [tablename]"


Set rst = CurrentDb.OpenRecordset(strSQL)

RgExp.Pattern = "^\d{11}\/\d{8}$"
'99900295953/00000001

rst.MoveFirst

Do Until rst.EOF
    If RgExp.Test(Nz(rst!field1, 0)) = True Then
        field1data = Left(rst![field1], 11)
    Else
        If TestDate(Nz(rst![PStart Date], 0)) = "valid" Then
            rst.Edit
            rst!field1 = field1data
            rst.Update
        End If
    End If
    rst.MoveNext
Loop

rst.Close
Set rst = Nothing
 

hardy1976

Still learning...
Local time
Today, 10:42
Joined
Apr 27, 2006
Messages
200
Sorry missed all the comments on here as I was trying to crack it - APPRECIATE ALL YOUR HELP EVERYONE
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:42
Joined
Oct 29, 2018
Messages
21,449
Sorry missed all the comments on here as I was trying to crack it - APPRECIATE ALL YOUR HELP EVERYONE
No worries. Good job figuring it out on your own then. Cheers!
 

Users who are viewing this thread

Top Bottom