Solved

How sequence by 1 for subsequent records

Posted on 2013-05-31
1
286 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
[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
1 Comment
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39211788
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

626 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