A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

autonumber



 
 
Thread Tools Display Modes
  #1  
Old April 23rd, 2010, 07:41 PM posted to microsoft.public.access
Emma
external usenet poster
 
Posts: 493
Default autonumber

I no I don't need an auto number but basically what I need is a number that
counts sequentially 1-[1st month end number] then starts over again for the
next month ie 1- [next month end number]. The field and column name is
[Financial ID].... I was thinking something like:

Private Sub Form_Before Update(Cancel as Integer)
If Me.NewRecord and Month([DateofLoanAgreement])=Month(Now()) then
Me![Financial ID] = Now() + Nz(DMax( "[Financial ID]", "[Loans -
Table]"])+1
End If
End Sub

I know it's all very confusing but maybe someone could help me organize this
so it makes sense? Not sure if I can put Now90's date in front of the auto
number? Or if I should be using the format?

  #2  
Old April 23rd, 2010, 11:15 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default autonumber

Emma

You do not need to actually store a "number" (it isn't a number, you know,
because you won't do any math on it) like that (and it's rarely necessary).
Storing more than one fact in a single field (your sequence number, a
"dash", and your [month end number]) is not good design.

Moreover, what happens NEXT year when you have another month "04"?!

By all means, do a search on-line for "custom autonumber" to get some ideas
on how to build a procedure that gives you sequential number. But decide
how to handle the same month happening year after year, and then look into
using a query to concatenate together the pieces you need to display --
e.g., your expression might look something like:

YourNewExpression: [YourSequenceField] & " - " & {YourYearMonthValue}

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Emma" wrote in message
...
I no I don't need an auto number but basically what I need is a number that
counts sequentially 1-[1st month end number] then starts over again for
the
next month ie 1- [next month end number]. The field and column name is
[Financial ID].... I was thinking something like:

Private Sub Form_Before Update(Cancel as Integer)
If Me.NewRecord and Month([DateofLoanAgreement])=Month(Now()) then
Me![Financial ID] = Now() + Nz(DMax( "[Financial ID]", "[Loans -
Table]"])+1
End If
End Sub

I know it's all very confusing but maybe someone could help me organize
this
so it makes sense? Not sure if I can put Now90's date in front of the auto
number? Or if I should be using the format?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.