473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

increment revision value

Hi All,

I have 2 fields called document & Revision which contains the titles for
the documents to be stored in the databse it gets filled up as the user
enters them and the revison numbers associated with them.
1. What I need to do is to make sure that no duplicate entry is entered for
document and if entered should have a different revison number. I cannot
make them both as the primary key bacause there may be times when both the
fields maybe null but the entry must be there in the database.
2. If the user types in an existing document then I need the revision field
to be filled up with the current revision number after update.

I am a bit stuck here and any help will be great.

--
'Thanks & Regards'
Nov 13 '05 #1
4 1894
"Burghew" <bu*****@mailinator.com> wrote:
If the user types in an existing document then I need the revision field
to be filled up with the current revision number after update.


There are a number of ways you could do this but perhaps using the DMax
method might be worth a look. You could have a DMax statement in the
'Default Value' property for your 'revision' text box such that it filters
your recordset for the contents of your 'document' field, finds the max
value from revision and then add 1:

DMax("[Revision]","[MyTable]","[Document] = 'MyCriteria'") +1

where MyTable is the name of your table and MyCriteria is the filter
criteria for the 'Document' Field.

I haven't tested this specific example but it should point you in the right
direction.

HTH - Keith.
www.keithwilby.com
Nov 13 '05 #2
As I recall, in Access, by creating a unique index on the combination of
fields (essentially a secondary key), you will enforce uniqueness, but allow
nulls. Another way to handle the optional nature of the document
title/revision combination is to split that into its own document identity
table, leaving the other fields in a document content table, and have a 1-to-1
relationship between them with the document content record as the source for
the primary key. The document identity table would use a uniqu index to
enforce uniqueness of the title/revision combination, but both fields would be
required since the record itself id optional.

To create a unique index on a combination of fields, you must go into the
indexes popup in table design, and put the 2 fields on consecutive rows with
the index name only on the first row. With the first row selected, check the
"Unique" box in the index properties.

On Tue, 14 Dec 2004 14:58:18 +0400, "Burghew" <bu*****@mailinator.com> wrote:
Hi All,

I have 2 fields called document & Revision which contains the titles for
the documents to be stored in the databse it gets filled up as the user
enters them and the revison numbers associated with them.
1. What I need to do is to make sure that no duplicate entry is entered for
document and if entered should have a different revison number. I cannot
make them both as the primary key bacause there may be times when both the
fields maybe null but the entry must be there in the database.
2. If the user types in an existing document then I need the revision field
to be filled up with the current revision number after update.

I am a bit stuck here and any help will be great.


Nov 13 '05 #3
Steve Jorgensen wrote:
As I recall, in Access, by creating a unique index on the combination of
fields (essentially a secondary key), you will enforce uniqueness, but allow
nulls.


No. I agree with you that it should (set theory) but Access doesn't allow.

Can't set the IgnoreNulls in the PK either. I can set the property in
another index (not a primary one) but I can still not enter a Null in
the field.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #4
You could set the default value for revision to "" and allow zero length
strings.

"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:cp**********@news2.solcon.nl...
Steve Jorgensen wrote:
As I recall, in Access, by creating a unique index on the combination of
fields (essentially a secondary key), you will enforce uniqueness, but allow nulls.


No. I agree with you that it should (set theory) but Access doesn't allow.

Can't set the IgnoreNulls in the PK either. I can set the property in
another index (not a primary one) but I can still not enter a Null in
the field.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Burghew | last post by:
Hi All, I have 2 fields called document & Revision which contains the titles for the documents to be stored in the databse it gets filled up as the user enters them and the revison numbers...
0
by: Anders W. Pedersen | last post by:
Hi there! I'm working on a medium-sized .NET web application written in c#. We are using Visual Studio 2003 for development and Visual Source Safe as our code repository. Occasionally, we do a...
3
by: fragget | last post by:
where can i find a plugin that will automatically update the build number in vs.net? thx fg
4
by: Klaus Jensen | last post by:
Hi! In VB6 I could set an option, so that when the app was built, the version number (minor) would autoincrement. It was also possible to access version information via code to display in a...
5
by: vul | last post by:
In VB6 there is Auto Increment check box in Project Properties, which allow you have a new version every time you compile the project. Is there any easy way to have this feature in VB 2005? Some...
2
by: john | last post by:
Is it true that if I split my access database in backend and frontend and I implement custom auto increment for the ID fields, that my database is ready to be used in a multi-user environment? I...
1
by: ewingate | last post by:
I cannot seem to get the version number of my VB app to increment properly in VS2005. When I build the app each day the "build" number increments with no problem as does the version number but if I...
11
by: divya_rathore_ | last post by:
The code: int aaa = 100; printf("%d %d %d\n", --aaa, aaa, aaa--); printf("%d\n", aaa); prints: 99 100 100 98
1
by: news.microsoft.com | last post by:
Is there a way to have a timestamp automatically become part of the Assembly version number? I.e., so everytime the DLL compiles, the assembly version updates? TIA- MS
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.