GClinic
Technical User
- Feb 16, 2008
- 13
Hi,
I have a myriad of textboxes on my form, and from time to time, I need to retrieve some of their values in comma-separated format. The textboxes are named in the format of a letter and two digits, for easy identification, like A22 or B54 etc.
Before a textbox is updated, I want a display of values in the adjoining boxes displayed to assist a user in making his decision.
This is the code that I tried on their got-focus event:
'If TypeOf Screen.ActiveControl Is TextBox Then
If IsNull(Screen.ActiveControl) Then
Dim X As Integer, P As Integer, Y As Integer, Z As Integer, S As String, Tx As Control, ImpoList As String
S = Screen.ActiveControl.Name
X = Mid(S, 2, 1)
Y = Right(S, 1)
Z = Screen.ActiveControl.Tag
For Each Tx In Screen.ActiveForm
If TypeOf Tx Is TextBox Then
If Tx.Name = "A" & Y & P Then
For P = 1 To 10
DoCmd.GoToControl Tx.Name
If Not IsNull(Tx) Then
ImpoList = ImpoList & "," & Tx.Text
End If
Next
End If
End If
Next
MsgBox ImpoList
End If
'End If
However, at the end of the event, my list is empty, when I can see several textboxes are not null. The code seems to work up to the line before:
Impolist = Impolist & "," & Tx.Text
What am I doing wrong?
I have a myriad of textboxes on my form, and from time to time, I need to retrieve some of their values in comma-separated format. The textboxes are named in the format of a letter and two digits, for easy identification, like A22 or B54 etc.
Before a textbox is updated, I want a display of values in the adjoining boxes displayed to assist a user in making his decision.
This is the code that I tried on their got-focus event:
'If TypeOf Screen.ActiveControl Is TextBox Then
If IsNull(Screen.ActiveControl) Then
Dim X As Integer, P As Integer, Y As Integer, Z As Integer, S As String, Tx As Control, ImpoList As String
S = Screen.ActiveControl.Name
X = Mid(S, 2, 1)
Y = Right(S, 1)
Z = Screen.ActiveControl.Tag
For Each Tx In Screen.ActiveForm
If TypeOf Tx Is TextBox Then
If Tx.Name = "A" & Y & P Then
For P = 1 To 10
DoCmd.GoToControl Tx.Name
If Not IsNull(Tx) Then
ImpoList = ImpoList & "," & Tx.Text
End If
Next
End If
End If
Next
MsgBox ImpoList
End If
'End If
However, at the end of the event, my list is empty, when I can see several textboxes are not null. The code seems to work up to the line before:
Impolist = Impolist & "," & Tx.Text
What am I doing wrong?