VBA used to create automatically increment invoice number

J

Jpolice

I used the Macro on the web site (Article ID : 212686) to create an Insertion
order form, each of which must have a unique number. The macro worked great
but the next step is to enter the number in our corporate system. The number
must be a 5-digit number.

I've never used Visual Basic before and am trying to understand how I can
change the number format in the form or in the macro to start at 00001.
Everything I've tried so far does not take.

We go through insertion orders like potato chips. If I could figure out how
to format to 5-digits through the macro named above, I would be raised on a
pedestal by my boss.
 
K

Karl E. Peterson

Jpolice said:
I used the Macro on the web site (Article ID : 212686) to create an
Insertion order form, each of which must have a unique number. The
macro worked great but the next step is to enter the number in our
corporate system. The number must be a 5-digit number.

I've never used Visual Basic before and am trying to understand how I
can change the number format in the form or in the macro to start at
00001. Everything I've tried so far does not take.

We go through insertion orders like potato chips. If I could figure
out how to format to 5-digits through the macro named above, I would
be raised on a pedestal by my boss.

It looks as simple as changing:

' Set form field result to stored value.
fField.Result = CStr(lRegValue)

to:

' Set form field result to stored value.
fField.Result = Format$(lRegValue, "00000")

Unless I misunderstand the question?
 
J

Jpolice

I made the change in the macro code and I understand the logic but it isn't
working. Editors always read what they think they wrote--but the change I
made to the fField.Result is typed in correctly. I must still be missing
something. Is there something more I need to do to make the change to start?
And thanks so much for your quick reply.
 
K

Karl E. Peterson

Jpolice said:
I made the change in the macro code and I understand the logic but it
isn't working. Editors always read what they think they wrote--but
the change I made to the fField.Result is typed in correctly. I must
still be missing something. Is there something more I need to do to
make the change to start? And thanks so much for your quick reply.

Well, define "isn't working" for me/us, please?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top