Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 8th, 2007, 11:29 PM
Registered User
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Old April 9th, 2007, 06:31 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

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?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access sequential numbering in a query ChadKempel Access 3 June 4th, 2007 12:49 PM
HELP!!!!! Sequential DTS e_cabrera_g SQL Server DTS 1 October 11th, 2006 11:54 AM
Create Sequential Numbering That Does not Skip mrslockdown2003 Access 4 May 11th, 2005 11:45 AM
Sequential numbering a non auto number field dbartelt Access 3 May 5th, 2005 02:56 PM
Sequential Row numbering in queriws civa Access 5 March 7th, 2005 02:13 AM

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