473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Shifting data to the right

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
Nov 12 '05 #1
2 2695
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

Nov 12 '05 #2
Thanks for your reply, it didn't work out of the box but after a
little tweaking I got it to work. This will save loads of coding and
re-naming of my textboxes. It got my mind looking at it differently as
I was bogged down.
Thanks for taking the time.
Rick
"Jim Beard" <ja*********@comcast.net> wrote in message news:<bxb8b.420166$o%2.191156@sccrnsc02>...
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

--

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Stockwell | last post by:
Hi, My background is c/c++ and java. I'm learning python at this point. My question is does python share java's peculiar mode of bit shifting, or does python adhere closer to c's bit shifting?...
17
by: Jack | last post by:
Hi, This is a strange problem I am encountering. I have a asp page with a confirmation.asp page that saves data to a table. There are few text fields that are captured by the confirmation page as...
9
by: GGG | last post by:
Noticed something odd in the way bit shifting was working today. As far as I have ever heard, shifting will shift in zeros(signed ints aside) However I foudn something odd when I am shifting...
8
by: ben | last post by:
i have a bit of code, that works absolutely fine as is, but seems over complicated/long winded. is there anyway to shorten/simplify it? the code is below. description of it: it's like strcpy in...
2
by: salsipius | last post by:
Can someone please help me clarify the below code. I think the shifting has to do with converting datatypes and/or loss of data but am not really clear on the details, could you help shed some...
10
by: krunalb | last post by:
Hi, I am trying to shift unsigned long long value by 64 bits and this is what i get #include <stdio.h> int main() { unsigned short shiftby= 64;
20
by: Charles Sullivan | last post by:
I understand different processor hardware may store the bits in a byte in different order. Does it make a difference in C insofar as bit-shifting unsigned char variables is concerned? E.g, if I...
16
by: lak | last post by:
i know left and right shift normally,but i cant know what happens if it is negative. for example int x=-2; x<<=1;//what happens here
6
by: Madhur | last post by:
I am having the following problem of bit shifting. My program runs on a little endian machine. Consider that if I have the following data represented in big endian... 0x12345678 the little...
4
by: Neil | last post by:
I previously posted about data shifting between records in my Access 2000 MDB with a SQL Server 7 back end, using ODBC linked tables. Every once in a while, data from one record mysteriously...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.