Tom,
Here is a sub that will change the Custom "Date" string you receive and store it in a new field that has been set up as DateTime Extended.
I specifically added a new field in Table1 with datatype DateTime Extended. I also went to the table and in Table Fields adjusted the decimal places of this field to 3 (It gives 7 by default).
I could not find info/example to do this with SQL.-- so DAO and recordset.
Reference link 'https://support.microsoft.com/en-us/office/using-the-date-time-extended-data-type-708c32da-a052-4cc2-9850-9851042e0024#bkmk_vba_string
There have been many cautions in the various articles re use of DateTime extended. But if you are happy to move with this, then proceed and verify your processes and any interactions with other applications.
Code:
' ----------------------------------------------------------------
' Procedure Name: Tom1
' Purpose: Change custom date [DATETIMESTAMP] as string to date extended field[moddateTimeX] in table1
' Procedure Kind: Sub
' Procedure Access: Public
' Author: Jack
' Date: 22-Oct-22
'Reference:
' ----------------------------------------------------------------
Sub Tom1()
10 On Error GoTo Tom1_Error
Dim db As Database
Dim rs As Recordset
20 Set db = CurrentDb
30 Set rs = db.OpenRecordset("Table1")
40 Do While Not rs.EOF
50 rs.Edit
'date normal yyyy/mm/dd hh:nn:ss . 3 digit millisec
60 rs!moddatetimex = Left(rs!DateTimeStamp, 19) & "." & Right(rs!DateTimeStamp, 3)
70 rs.Update
80 ' Debug.Print rs!DateTimeStamp & "====>" & rs!moddatetimex
90 rs.MoveNext
100 Loop
110 rs.Close
120 db.Close
130 On Error GoTo 0
Tom1_Exit:
140 Exit Sub
Tom1_Error:
150 MsgBox "Error " & Err.Number & " (" & Err.Description & "), line " & Erl & " in Procedure Tom1" _
& " Module Module1 "
160 GoTo Tom1_Exit
End Sub
Attached is the Updated Database. Table1 has been updated with the DateTime extended value via sub Tom1()