473,320 Members | 2,083 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,320 software developers and data experts.

Increment by 1 if duplicate text value

I have a table with the following:

AutoNumber Course Name (a text field)

I want to add a Section Field that increments beginning with 001 all
the way to 999, for Each UNIQUE Course Name.

For Example:

Let's say I have a course Name in this table of "MS Word 2003 Level 1".
In the table, is there any way for Access to assign a Section #
automatically if the text value is duplicated.

Any suggestions would be greatly appreciated

Jan 23 '06 #1
1 2735
rech340 wrote:
I have a table with the following:

AutoNumber Course Name (a text field)

I want to add a Section Field that increments beginning with 001 all
the way to 999, for Each UNIQUE Course Name.

For Example:

Let's say I have a course Name in this table of "MS Word 2003 Level 1".
In the table, is there any way for Access to assign a Section #
automatically if the text value is duplicated.

Any suggestions would be greatly appreciated

I guess. This could be 1 to many. Create another table with the
tableid for the course and the section field number. Set a flag whether
or not it is a new record in the BeforeUpdate event of the form. If so,
use a For/Next loop to go add 999 Section records.

Or, you could change the CourseName field index to allow duplicates.
Then in the BeforeUpdate event for the form, add something like
If Me.NewRecord Then
Me.Section = NZ(Dmax("Section","YourTableName" _
"CourseName = '" & Me.CourseName & "'") + 1
Endif

Now, if you change a course name, you'd want to update all other course
names to the new course name

Jan 24 '06 #2

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

Similar topics

0
by: Gena | last post by:
Hi, Can anyone help me to increment the primary key's value on duplication without using mysql v 4.1 "on duplicate key" function? I can't upgrade to use the "on duplicate key" feature so am now...
3
by: ColinWard | last post by:
I am using the following code to validate that the person that is being entered into the database does not already exist. However wnem I test it by entering myself as a contact(I first checked that...
1
by: tHeRoBeRtMiTcHeLL | last post by:
Below is an earlier post to an Excel Group.. ....but I thought that there might be a way to do this in Access by importing data and then creating append and/or update query. I would most certainly...
2
by: Mike N. | last post by:
Hello again.. I have a table with a text field named "Requisition" (Indexed, no dupes). It is not the key field. This field is the first text box on a form. I would like to check to make sure the...
5
by: Stuart | last post by:
Hi all, Iv'e got a page that has a mass amount of input fields, all of which require a decimal figure. To make it easier when it comes to inputting data, I'm trying to setup + and - links that...
13
by: technocraze | last post by:
Hi guys, I have an issue with incrementing a counter in a table using VB in MS Acess environment. Below mentioned is an instance. Implementation logic Table fields Serialno = pk Datatype...
0
by: =?Utf-8?B?SGF3aw==?= | last post by:
Hello, I have the need to verifiy a field in a gridview for a duplicate value against a database before the update takes place. I was thinking that the gridview1.rowupdating would be a good place...
13
by: jehugaleahsa | last post by:
Hello: In C++, you had to distinguish between post and pre increments when overloading. Could someone give me a short demonstration of how to write these? I get the impression that are...
1
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.