p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Sequential numbering help (http://p2p.wrox.com/showthread.php?t=56403)

gear1 April 8th, 2007 11:29 PM

Sequential numbering help
My Access database has Data field, Year field, Number field. The number field is set with DMax function which will reset the number to 1 when the year changes. I was help on the following :
1. The DB should take only the current year's records for active use i.e. data entry, edit, search, print etc.
2. The DB should allow previous year's records for search and print only and NOT allow data entry and edit.
How can I do it. Please help

mmcdonal April 9th, 2007 06:31 AM

Before you do either of these functions, take the year in a variable and pass it to the function.

dtCurYear = DatePart("yyyy", Date())

For example when you open the data entry form, set the filter to the current year, or if it is based on a query, pass the year to the query(WHERE [dtYear] = " & dtCurYear

Allow users to open the form for previous years, but on that button, pass WHERE [dtYear] <> " & dtCurYear.

You may have to add date ## signs before and after. And of course you will want to date stamp every record with the current year. It is easier if you store the year by itself in a seperate field as I have done, but you can also just add a date created field, pass the current date to it, and check the year datepart of that field.

Did this help?


All times are GMT -4. The time now is 11:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.