Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering text by order row

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
969
0
16
GB
I am trying to enter free txt and on change of order row number have the correct text under the correct row (I have grouped the rows). I have created a row number in an access table (no other tables connected at all)

I am not very up on formula and this thus far but it is not working, currently it is asking for a string required at the Else IF part. Could someone advise me please how the code should be please, I intend to have up to potentially 6 rows., thanks in advance

If {Table1.Row} = 1 then

WhilePrintingRecords;
StringVar Array Input := {?Pack};
NumberVar howmany:= count (Input);

Input [1] +
if howmany > 1 then ', ' + Input [2] +
if howmany > 2 then ', ' + Input [3] +
if howmany > 3 then ', ' + Input [4] +
if howmany > 4 then ', ' + Input [5] +
if howmany > 5 then ', ' + Input [6] +
if howmany > 6 then ', ' + Input [7] +
if howmany > 7 then ', ' + Input [8] +
if howmany > 8 then ', ' + Input [9]



ELSE IF {Table1.Row} = 2 then

WhilePrintingRecords;
StringVar Array Input := {?pack2};
NumberVar howmany:= count (Input);

Input [2] +
if howmany > 1 then ', ' + Input [10] +
if howmany > 2 then ', ' + Input [11] +
if howmany > 3 then ', ' + Input [12] +
if howmany > 4 then ', ' + Input [13] +
if howmany > 5 then ', ' + Input [14] +
if howmany > 6 then ', ' + Input [15] +
if howmany > 7 then ', ' + Input [16] +
if howmany > 8 then ', ' + Input [17];
 
I know that if you have multi-line statements in the 'then' or 'else' of a if statement, then they have to be enclosed in parens. Otherwise you will get very odd results.
 
Hi

Yes but it is where the then or else etc... need parens. I have tried everything going but seem to be going around in cirlces

Currently I now have my formula as below. This works fine if table1.row = 1. What I cant figure out is how to add the text so if it is table1.row = 2.
HAs anyone any ideas please and also how the formula should look. I will keep trying in the mean time and update if I get it working. Thanks

If {Table1.Row} = 1 then

(

WhilePrintingRecords;
StringVar Array Input := {?Pack}; // replace this with your string prompt
NumberVar howmany:= count (Input);

Input [1] +
if howmany > 1 then ', ' + Input [2] +
if howmany > 2 then ', ' + Input [3] +
if howmany > 3 then ', ' + Input [4] +
if howmany > 4 then ', ' + Input [5] +
if howmany > 5 then ', ' + Input [6] +
if howmany > 6 then ', ' + Input [7] +
if howmany > 7 then ', ' + Input [8] +
if howmany > 8 then ', ' + Input [9]


);
 
I have made a little progress but obviously the code is still incorrect.

Row 1 should be

1 Pack: 8128990 60/1.1,
[pre][/pre]Pack: 8128990 60/1.2,
[pre][/pre]Pack: 8128990 60/1.3
 
Sorry did not finish the post above

I have made a little progress but obviously the code is still incorrect (codes as it is shown below).

Row 1 and 2 should be

Row1 Pack: 8128990 60/1.1,
Pack: 8128990 60/1.2,
Pack: 8128990 60/1.3

ROW2 Pack: 8128990 60/1.1, (this should be Pack: 8128990 60/2.1, then 60/2.2, then 2.3for some reason it is grabbing the first row from row 1 and leaving out 2.3 of row 2)
Pack: 8128990 60/2.1,
Pack: 8128990 60/2.2

However as you can see it as picked up the fist code from Row one Pack: 8128990 60/1.1, and out it in the row 2 also.
Also other rows, 3,4,5 etc... also have the ROW2 information in them, basically if there are no more packs to add then any other row numbers should be blank.

Could someone please help with the coding on this

Thanks
 
Hi

I have now gone down the route of having 3 different parameter fields and 3 different formulas.

PAck1, Pack2 and Pack 3.

In the formula for each one I have the below formula but have changed it to relate to the row number and parameter name for each paramter. It works accept for, it wants an entry in the parameters and wont OK if I have not put anything in the multiple selection for each row, I can just put a space and it works but ideally I only want to be information into the rows where data is required. So does anyone know how I can set things so it will work if nothing is entered into the parameter prompt, thanks

If {Table1.Row} = 1 then

(

WhilePrintingRecords;
StringVar Array Input := {?Pack}; // replace this with your string prompt
NumberVar howmany:= count (Input);

Input [1] +
if howmany > 1 then ', ' + Input [2] +
if howmany > 2 then ', ' + Input [3] +
if howmany > 3 then ', ' + Input [4] +
if howmany > 4 then ', ' + Input [5] +
if howmany > 5 then ', ' + Input [6] +
if howmany > 6 then ', ' + Input [7] +
if howmany > 7 then ', ' + Input [8] +
if howmany > 8 then ', ' + Input [9]

ELSE ""
);


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top