473,385 Members | 1,465 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,385 software developers and data experts.

Want To Create New Record Based On Job Number and Add 1 To Revision Number

I inherited an Access database and I'm trying to add on a method of creating a revision level field that can count up as needed.

I have 2 fields: Job Number and Revision Number. I want to create a button that creates a new record based on an old job number and then do a validation which ups the revision number by one.

For example: I already have job number 1234, Rev 1. I would like to have a drop down to select job 1234 and then the system looks to see what the highest revision level is for 1234 and then assigns it Rev 2.

Thank you.
Oct 16 '18 #1
1 4891
NeoPa
32,556 Expert Mod 16PB
If you have a [Job No] selected and you want to create a new [Revision No] for a new record which is one more than any that currently exists then you need to find the maximum [Revision No] used so far.

In VBA that can be done using DMax(), a Domain Aggregate function. Assuming the selected [Job No] is currently held in a variable called strJobNo then you want something similar to :
Expand|Select|Wrap|Line Numbers
  1. lngRevisionNo = Nz(DMax(Expr:="[Revision No]" _
  2.                       , Domain:="[YourTable]" _
  3.                       , Criteria:="([Job No]=" & strJobNo & ")"), 0)
NB. I've assumed both are numeric fields due to the lack of relevant information in the question. If either field isn't then you need to handle the quotes (See Quotes (') and Double-Quotes (") - Where and When to use them).
Oct 16 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: valexena | last post by:
Which clause in a create user statement restricts the number of tables a user can add to a tablespace? -- Posted via http://dbforums.com
5
by: Derek Cooper | last post by:
I hope you can help me. I posted this in the microsoft sql server newsgroup a few days ago and got no response so I thought I'd try here. If I can provide any clarification I'll be glad to do so....
9
by: Bill | last post by:
I need to create a temporary file on the file system. I have over 5000 users What's the best method to ensure uniqueness Thank Bill
1
by: zeeshansohail | last post by:
I have two tables named as “COMPANY and BILL_DETAIL” with the following structure. BILL_DETAIL TABLE Name Type Nullable ------------- -------------- -------- ...
3
by: bubbadump | last post by:
I'm new to the forum, but am looking for help trying to populate several text boxes based on a drop down that will choose an asset number. my Combo box is named GP, I will pick a number from this...
4
by: ringer | last post by:
I have a db where each record is a certain task to be done. Each record includes the date the task should be completed. Some of the tasks are one time only but some are recurring. I have been having...
1
by: cbnewman | last post by:
What is the best way to accomplish the following: I would like to generate a report that changes the text size and italicization based on a boolean variable (present in the row of the data...
11
by: prashantdixit | last post by:
Hi, I am developing a stock control software. Iam stuck somewhere. I have a form "Add new stock" consisting of combobox, text boxes etc. which is used to add records in a table. I have another...
3
by: walshm | last post by:
Good morning! I am using Access 2007. I have two forms that are for other users to enter data. Form 1 is strictly a "search" type form. There are two command buttons to allow the user to...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.