Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Counting and Assigning Numbers
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Crystal, post: 11386188"] Help Please. I have the following code and need help figuring out what I'm missing. I need to find the Highest Number and add 1 looping thru the remaining fields that are Not Null. Private Sub Close_Form_Click() Dim db As Database, rst As Recordset, lTotal As Long, lCounter As Long Set db = CurrentDb Set rst = db.OpenRecordset("SELECT * FROM [Set Priority Level] WHERE ((([Set Priority Level].[PRIORITY]) Is Null));", dbOpenDynaset) 'return number of records in recordset lTotal = rst(0) Dim HighestNumber As Long HighestNumber = DMax("[PRIORITY]", "HWIL - Set Priority Level", "[PRIORITY] is Not Null") For lCounter = 1 To lTotal Do While Not rst.EOF rst.Edit rst!PRIORITY = HighestNumber + 1 rst.Update rst.MoveNext Loop Next lCounter rst.Close Set db = Nothing Set rst = Nothing DoCmd.RunMacro "Priority" DoCmd.Close End Sub [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Counting and Assigning Numbers
Top