Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Microsoft Access 2010 Add a -1 to 20130001 now may be 20130001-1

Posted on 2013-11-30
12
Medium Priority
?
288 Views
Last Modified: 2013-12-09
I have a table tblrecordlog.  I have a key field but also have a recordnumber in the format the client was using manually before for example 20139999.  I have this number as a double now. The client would like to be able to add a record and a decision would later be made to possibly break up the project into multiple records. They want 20139999-1 for example. Do I set up another table? Do I to change the format of the field? Not each project will be divided. The -1 record would be independed of the original record or maybe I can delete the original record and have them all start out all records with -1.. I am not sure if I like that or not. Can someone give some insight. Thanks.
0
Comment
Question by:marlind605
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
12 Comments
 
LVL 40

Expert Comment

by:als315
ID: 39686978
You can convert recordnumber field to text and use it. Sometimes better to have separate field for project, in this case you can add index for this field and queries can work faster. On forms number and project can be combined.
You should give us more details about DB, if you like to get qualified answer.
I prefer not to use double for numbers without decimal part
0
 
LVL 39

Expert Comment

by:PatHartman
ID: 39686990
If the copied project is completely independent of the project it was copied from, then you would just assign a new number.  The -1 implies that there is some relationship.  If there is a relationship, then the better solution would be to create a new table that can be used to group projects.  You would still assign a new ID.
0
 

Author Comment

by:marlind605
ID: 39687150
I do have a seperate number for the index field. The record number is generated by YYYY#### #### being 0001 0 - 9999 My vision is to click on a button on a form correspending to the original record. The button will copy all of the record and the user would change the details to the way they need to. I can change the field to text but I am not sure how to add a -1 based on the recordnumber now text. And it could start with -1 and go to 99 for example. 20130001-1 to 20130001-99.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Accepted Solution

by:
als315 earned 1000 total points
ID: 39687233
You can always generate string from parts. In your case it will be something like:
=RecordNumber & "-" & ProjectNumber
if RecordNumber is text. If it is numeric, you can add format:
=Format(RecordNumber, "00000000") & "-" & ProjectNumber
0
 
LVL 39

Expert Comment

by:PatHartman
ID: 39687238
If the records are not related once they are split, why do you need to add a suffix to the ID field?  Why not just assign the next available number?   If you wanted to track the source, simply add another column to the table where you can store the original ID.  I would use the autonumber PK rather than the generated number for this purpose.
0
 

Author Comment

by:marlind605
ID: 39687364
The client wants it this way.
0
 

Author Comment

by:marlind605
ID: 39687366
A request will come in the form of an email etc and there may be multiple steps in the request.
0
 
LVL 39

Expert Comment

by:PatHartman
ID: 39687635
If the projects are related, you do "A", if they are not related you do "B".    Sounds like they are related and that requires a structure change so you can group them.  Add an additional column for the suffix because you will now have a second field to increment unless you are going to allow the user to specify the suffix.
0
 

Author Comment

by:marlind605
ID: 39692827
RIght now I am using a NZ(Dmax) to generate my current number it places the currentyear in front of a sequencial number based on records that is already in the table. in the table. How do I generate a new number that shows 200130001-1 20130001-2 20130001-3 .... based on 20130001 already in the table. Now all I want to do is allow the user to add another record copy that record and it looks in the table for matching prefix numbers and add another sequence.
0
 
LVL 39

Assisted Solution

by:PatHartman
PatHartman earned 1000 total points
ID: 39693361
When you construct "meaningful" IDs, they should have meaning.  If you will ever want to join the various 20130001 records, you need to put the suffix into a separate column or pay the price later.  If you don't think you would EVER need to bring these records together then, what in the world is the suffix all about?  Adding a second column for the suffix will also mean that you need to add an additional column to the unique index on this field.  Set the default for the column to 0.  After you add the column, you will need to run an update query to replace all null values with 0.  If you prefer to start with 1 rather than 0, then make 1 the default and replace the nulls with 1's.  You'll need to fix the data before you alter the index to avoid duplicates.
0
 

Author Comment

by:marlind605
ID: 39698071
PatHartman
The whole purpose of this database is to track records request that is the reason for the name. I have added a field supplemental. Each record does have a never seen by the user ID number auto-number key field. I have created a form that when the user wants to split the request they can do so. The user specifically requested to keep the record number and add-1 to what maybe 1 or multiple split events. So I seem to be looking at a DMAX + 1 solution to see if this solution would work and use the update query like you suggested. I am thinking out loud now. Today I need to make a form where the user clicks add supplemental. Database will copy record assign a new unique number. I need to have it show the 20130001 with a -1 for the new record. Hope this helps. I will be looking at what I can do with this today.
0
 

Author Comment

by:marlind605
ID: 39698523
I got it. I will be awarding points later today. No more answers required. Thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question