Check textbox array for null values

Ok
I can sort of see where this is going. I'll work on this first thing Monday morning.

Thanks for all your help today men
 
I think I'm kind of seeing where you are going with this. You kind of want to display your own grid?

Suppose you labels the text boxes as

text11, text12, text13.... text17
text21, text22, text23....text27
..
..
text71, text72, text73...text77

Then you can reference each text box as if it were an array element like this:

Code:
rowID = 6
colID = 7
Me.Controls("text" & rowID & colID) = "some stuff"


So you can iterate through the rows cols like this:

Code:
For RowID = 1 To 7
    For ColID = 1 To 7
        If IsNull(Me.Controls("text" & RowID & ColID)) Then
        'do something about it
        End If
    Next ColID
Next RowID


Does that help?

Chris
 
Stopher
The word grid is what i was looking for and that could probably have made life easier for everyone.
This is the exact concept my destination form has. I am out of work now but will love to test this along with Brighton's look. One question. actually 2

1. Are you saying as long as my text boxes are in a row and columns I can reference them as per your example and access will know what row and column and which row I am referring to.

2. Say in your example of 77 textboxes,

Then you can reference each text box as if it were an array element like this
Would I have to do each box one at a time.
 
1. Are you saying as long as my text boxes are in a row and columns I can reference them as per your example and access will know what row and column and which row I am referring to.

No. The rows and columns are a notional concept expressed as a naming convention.
2. Say in your example of 77 textboxes, Would I have to do each box one at a time.

No. Stopher's code uses a For Loop to work through the names of the controls.

BTW. Another way to do this is with a For Each loop that will address each control on the form. Stopher's code is a better technique.

Parse the Name of the control to determine the action. Something like this:

Code:
Dim ctrl as Control
For Each ctrl In Me
If Mid(Me.controlname, x, y) = whatever Then
{do the appropriate actions}
Next

Another uses the Tag property to direct the procedure and avoids the need for a naming pattern on the control.

As Linq says "there is more than one way to skin a cat"
 
Last edited:

Users who are viewing this thread

Back
Top Bottom