Rick--
With the naming system for the text boxes that you descibe, it sounds like there's no array or matrix of boxes, just a lot of single boxes. You could take advantage of one of the ways to name a control, namely the
Me("txt" & format(n,"00"))
form, where n is the number of the box you want. Using the setup you describe, you could use something like:
Sub MoveStuffRight(RowNum as Integer, ColNum as Integer)
'
'This just moves things right by one position. Any contents in the last cell are lost.
'RowNum is the row you want to work in, and ColNum is the column of the box you
'will empty by moving its contents to the right
For i = (ColNum * RowNum) + 1 to RowNum * 8
Me("txt" & format(i, "00")) = me("txt" & format(i - 1, "00"))
Next i
Me("txt" & format(ColNum, "00")) = ""
Me("txt" & format(ColNum, "00")).SetFocus
End Sub
I haven't tried this out, of course. Hope it helps.
Jim Beard
"Rick Brown" <rb*******@compuserve.com> wrote in message news:82**************************@posting.google.c om...
Access97 using VBA code.
I have an array of textboxes, 8 columns across and 5 rows down.
If all the boxes in row 3 have data in them and I place my cursor in
the 4th box in this row, how can I move the contents of 4 to 5 then 5
to 6, 6 to 7, and 7 to 8.
I don't want to effect rows above and below row 3.
All I want to do is push data to the right making room to insert an
item to a lineup.
My textboxes are named txt01 thru txt40
Each row represents a different machine lineup.
I've looked at select case using Case txt17 to txt24 then breaking it
into if txt17 if txt18 etc. This looks bulky and I hoped there might
be a simpler solution via a function.
Any suggestions.
RICK