469,909 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

Invoice Numbers - bound control issue

I need to set up invoices so each new invoice has next available number
assigned.

I have a table Named "InvoiceNumbers" that has a single field =
"nextnumber"

A 2nd table that contains the sales transaction info including a field
named "invno".

Then created a form to input the sales and in the form is where I want
the number to update for each new invoice.

What I have done so far is set up code in the form (BeforeInsert event)
as follows:

Me.Invno=NZ(Dmax("[InvoiceNumbers]","[NextNumber]"))+1
Me.Dirty=False

What is happening is the first invoice will update by 1 and then any
other new invoices will duplicate that same invoice #.

What I'm missing is set up a bound between the field "Invno" and
"nextnumber" - I'm not sure how to do that - I have tried to go into
the control source of the field "invno" in the form and set it up but
keep getting a #Name? error.

I was able to get most of this from the newsgroup but need a bit more
assistance. Thx.

Sep 12 '06 #1
2 1524
Not sure why you need to have a separate table to just hold the "next
number"
why not use the invoices table itself:
Me.Invno=NZ(Dmax("[Invno]","[2ndTable]"))+1

If you search google groups, you should see lots of examples of homemade
autonumber generation.
-John

"samdev" <la***@noblesoftwaresolutions.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
>I need to set up invoices so each new invoice has next available number
assigned.

I have a table Named "InvoiceNumbers" that has a single field =
"nextnumber"

A 2nd table that contains the sales transaction info including a field
named "invno".

Then created a form to input the sales and in the form is where I want
the number to update for each new invoice.

What I have done so far is set up code in the form (BeforeInsert event)
as follows:

Me.Invno=NZ(Dmax("[InvoiceNumbers]","[NextNumber]"))+1
Me.Dirty=False

What is happening is the first invoice will update by 1 and then any
other new invoices will duplicate that same invoice #.

What I'm missing is set up a bound between the field "Invno" and
"nextnumber" - I'm not sure how to do that - I have tried to go into
the control source of the field "invno" in the form and set it up but
keep getting a #Name? error.

I was able to get most of this from the newsgroup but need a bit more
assistance. Thx.

Sep 12 '06 #2
Thank you!, Thank you....what I was trying to do was from the groups
and couldn't get it to work - your solution was very simple! Thank you!
John Welch (remove remove) wrote:
Not sure why you need to have a separate table to just hold the "next
number"
why not use the invoices table itself:
Me.Invno=NZ(Dmax("[Invno]","[2ndTable]"))+1

If you search google groups, you should see lots of examples of homemade
autonumber generation.
-John

"samdev" <la***@noblesoftwaresolutions.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
I need to set up invoices so each new invoice has next available number
assigned.

I have a table Named "InvoiceNumbers" that has a single field =
"nextnumber"

A 2nd table that contains the sales transaction info including a field
named "invno".

Then created a form to input the sales and in the form is where I want
the number to update for each new invoice.

What I have done so far is set up code in the form (BeforeInsert event)
as follows:

Me.Invno=NZ(Dmax("[InvoiceNumbers]","[NextNumber]"))+1
Me.Dirty=False

What is happening is the first invoice will update by 1 and then any
other new invoices will duplicate that same invoice #.

What I'm missing is set up a bound between the field "Invno" and
"nextnumber" - I'm not sure how to do that - I have tried to go into
the control source of the field "invno" in the form and set it up but
keep getting a #Name? error.

I was able to get most of this from the newsgroup but need a bit more
assistance. Thx.
Sep 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by David B | last post: by
15 posts views Thread by NomoreSpam4Me | last post: by
1 post views Thread by =?Utf-8?B?ZXZhbmdlbGl0amVycnk=?= | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.