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.

Re: VBA used to create automatically increment invoice number by Karl

Karl
Tue Dec 13 13:38:59 CST 2005

Jpolice wrote:
> 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?
--
Working without a .NET?
http://classicvb.org/



Re: VBA used to create automatically increment invoice number by Jpolice

Jpolice
Tue Dec 13 14:11:02 CST 2005

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.

"Karl E. Peterson" wrote:

> Jpolice wrote:
> > 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?
> --
> Working without a .NET?
> http://classicvb.org/
>
>
>

Re: VBA used to create automatically increment invoice number by Karl

Karl
Tue Dec 13 14:18:58 CST 2005

Jpolice wrote:
>> Jpolice wrote:
>>> 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?
>
> 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?
--
Working without a .NET?
http://classicvb.org/



Re: VBA used to create automatically increment invoice number by Jonathan

Jonathan
Wed Dec 14 10:13:03 CST 2005

Does this article do what you need?

Creating sequentially numbered documents (such as invoices)
http://www.word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

"Jpolice" <Jpolice@discussions.microsoft.com> wrote in message
news:EF0FAF6E-5D92-47C7-97CE-26D6BE4C0442@microsoft.com...
>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.