Solved

How sequence by 1 for subsequent records

Posted on 2013-05-31
1
280 Views
Last Modified: 2013-05-31
This will be tricky I'm sure.

I have a form which is used to record a project.  A project can have more than one TransRecord which is a text field on the form.

So, for example, Project #1 may have a TransRecord (a text field), that is "TransRecord#1".  Then the same project, Project #1, could have a TransRecord that is "TransRecord #2" and so forth.

But also on this form is a 4 digit number field formatted to look like "0001", "0002", "0003" and so on.

Here's what I need to do... for the first record of a unique TransRecord I want the 4 digit number to automatically populate to read "0001".  Then for the next TransRecord I want the 4 digit number field to be "0002".  And so on.

I expect that the code will have to be in the afterupdate event of the TransRecord field but I can't begin to know how to code this.

Can someone help?
0
Comment
Question by:SteveL13
1 Comment
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
You can use DMax to determine the "highest" value in a specific column in a table:

Dim MyMax As Double

MyMax = DMax("FieldContainingTheNumber", "YourTable", "TransferRecord=" & Me.YourTransferRecordField)

MyMax would then contain the highest value found, and you could then add 1 to it.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now