I have a subform with a text field that I am trying to append leading zeros.
Table = [tblSampleLogIn]
Table = [tblMycoData]
Form = [frmSampleLogIn01]
Form = [subMycoData] ; Field = [SampleID] Text
Here is my code so far:
The text values will be less than 6 characters in length. I can get the immediate window to return the value in the field by entering the following into the immediate window:
Private Sub SampleID_AfterUpdate()
Dim srtSampleID As String
Set srtSampleID = Forms![frmSampleLogIn01]![subMycoData].Form![SampleID].Value
Forms!frmSampleLogIn01!subMycoData!SampleID.Value = Format(Forms!frmSampleLogIn01!subMycoData!SampleID.Value, "000000")
But then, nothing else happens when the code runs.
Ultimately, I need to have leading zeros in front of the values to sort the text values. The reason is because sometimes a numerical character is unknown, and will be substituted with a "?". Having leading zeros will help to properly sort the text values.