Box Number Of Number Vba Help S’abonner

0
Avatar
Legacy Poster

Hi All,

 

I've just been asked to try and figure out some VB code to accomplish the following;

 

I essentially want to create a field that looks at a quantity, and then increments a number based on the number of copies of that label.

 

So basically we'll have 1 of 2, 2 of 2, 1 of 3, 2 of 3, 3 of 3, etc, etc

 

We have a workaround that involves selecting only certain lines of the data to print, and doing this for each individual line, as the first number (i.e the "1 of" number) just continually increases based on the number of copies, so regardless of the second number, it will keep increasing (i.e 1 of 2, 2 of 2, 3 of 3, 4 of 3, 5 of 3, etc).

 

I imagine the code will look something like this;

 

FirstNumber.Value = 1

For Each Copy

FirstNumber.Value = FirstNumber.Value + 1

Loop Until

FirstNumber = SecondNumber

Goto Next Copy and repeat event

 

Has anyone got any ideas?

 

Thanks guys!

8 commentaires

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Are you doing this through external VB.net automation? Or are you looking for help doing the VBA inside BarTender?

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Are you doing this through external VB.net automation? Or are you looking for help doing the VBA inside BarTender?

 

VBA inside BarTender, on the properties of a text box.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Wouldn't it be easier to set the field to be equal to the qty you need and use the decrement function?  this would give you labels in reverse ... 

 

30 of 30

29 of 30

28 of 30 ... and so on.

0
Avatar
Michael Toupin (mtoupin
Actions pour les commentaires Permalien

If you're using 10.1, you can achieve this without doing any scripting by just setting the reset to 'per database record'.  

 

To do it using VB, create an "OnNewRecord" event and just do 'value = 1'.  That way it will reset per record.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Wouldn't it be easier to set the field to be equal to the qty you need and use the decrement function?  this would give you labels in reverse ... 

 

30 of 30

29 of 30

28 of 30 ... and so on.

How would I then reset the value to be equal to a new number of?

 

If you're using 10.1, you can achieve this without doing any scripting by just setting the reset to 'per database record'.  

 

To do it using VB, create an "OnNewRecord" event and just do 'value = 1'.  That way it will reset per record.

I'll see what I can do, currently BarTender isn't on my machine so I can't do much with it right now!

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

For each new record being printed the value would reset.  Maybe I am misunderstanding your requirements but for each record the qty value woul dbe set by either a database field or a user input and that field would two seperate objects on the label.  One that is static and one that is set to decrement.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

For each new record being printed the value would reset.  Maybe I am misunderstanding your requirements but for each record the qty value woul dbe set by either a database field or a user input and that field would two seperate objects on the label.  One that is static and one that is set to decrement.

 

I might not have explained it very well either.The number of copies is set to a datasource value, ie the number of boxes in the spreadsheet. Then for each copy, I want this field to say "1 of", "2 of" etc, until it hits the same value as the number of boxes, and then moves on to the next record, doing the same thing.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Right I've kind of got this working, but I'm having a bit of a moment here.

 

On the newrecord event, I have the value of the FirstNumber set to equal the value of the SecondNumber. Then on the identicalcopies event, I have Value = Value - 1.

 

Problem is, the first record then starts at 1 less than it should be, going down to 0 and then resetting.

 

Please see screenshot;

 

http://imgur.com/pB7uJEW (won't let me post an image)

 

Any ideas anyone?

 

Thanks!

 

EDIT: NEVERMIND! GOT IT! Thank you all for your help, really appreciate it!

Vous devez vous connecter pour laisser un commentaire.