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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|