Kennelbloke
Technical User
Hi Folks
Got a report and in it I have 25 Text fields named txtName1 .... to ... txtName25. the fields were setup and then copied and pasted then the name changed.
I'm using the following to seperate out each char in the pet's name (me!PetName) and put it into each of the text fields (i.e. 1 char per field)
However when the vcounter value gets to 8, it won't +1 and resets back to 1. I've changed to vcounter to integer type and it does not make any different.
If I start the vcounter at 9 it works fine from there. I've deleted the field and recreated it and again no change. If I start vcounter from 5 it only goes to 8. If I start vcounter at 8 it only does the 8th one and resets back to 1.
This is so bazaar. Anyone possibly have an idea whats going on.
I'm off to open another bottle of wine.
Got a report and in it I have 25 Text fields named txtName1 .... to ... txtName25. the fields were setup and then copied and pasted then the name changed.
I'm using the following to seperate out each char in the pet's name (me!PetName) and put it into each of the text fields (i.e. 1 char per field)
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim vcounter As Variant
Dim tmpltr As String
vcounter = 1
If Me!PetName <> "" Or Not IsNull(Me!PetName) Then
For Each ctrl In Me.Controls
If ctrl.Name = "txtName" & vcounter Then
tmpltr = Mid(Trim(Me!PetName), vcounter, 1)
ctrl.Value = StrConv(tmpltr, 1)
vcounter = vcounter + 1
tmpltr = ""
End If
Next
End If
End Sub
However when the vcounter value gets to 8, it won't +1 and resets back to 1. I've changed to vcounter to integer type and it does not make any different.
If I start the vcounter at 9 it works fine from there. I've deleted the field and recreated it and again no change. If I start vcounter from 5 it only goes to 8. If I start vcounter at 8 it only does the 8th one and resets back to 1.
This is so bazaar. Anyone possibly have an idea whats going on.
I'm off to open another bottle of wine.