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

Assign next sequence # inside a form

I need to assign a new, sequential, Work Order number inside the WO# field of my Orders table. I also want to to have control over the number assignment using a double click button in the Order form. (Note: I'll use the same process to assign an Invoice number as well.

I want control over the numbers because not all entries will require a Work Order number. (By the way all records are tracked with an AutoNumber)

I have a table called SysCode # with a field called Last WO# which is used to track the last number I used. By activating the "Next Work Order #" button, I want the SysCode table field: Last WO# to updated by adding 1, and then insert the new number into WO# field in the Orders table.

Please help me figure this problem out
Nov 3 '06 #1
3 2499
NeoPa
32,556 Expert Mod 16PB
When assigning a number, use DMax() of existing records then add 1.
Nov 3 '06 #2
When assigning a number, use DMax() of existing records then add 1.
Thanks for the reply. How can activate this using a form buttom?
Nov 4 '06 #3
PEB
1,418 Expert 1GB
In the form bouton choose on click property and assign event procedure int window trhat appears:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim last_number
  3. dim mydb as database
  4. dim myr as recordset
  5. Set mydb=CurrentDb()
  6. Set myr = mydb.openrecordset("SELECT Number_Column, MyNumber FROM SysTable WHERE MyNumber='WorkOrders';")
  7. myr.movefirst
  8. myr.edit
  9. myr("[Number_Column]")=myr("[Number_Column]")+1
  10. Me![WorkOrderSequence]=myr("[Number_Column]")
  11. myr.update
  12. myr.close
  13. mydb.close
  14.  
  15.  
Take care my frien to do the replacements as it needed....

:)
Nov 4 '06 #4

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

Similar topics

1
by: google | last post by:
It would seem that when I assign an HTML entity to a form text input using "inline" javascript that it will display properly. But when trying to set it via a function call, the entity text shows...
14
by: amywolfie | last post by:
Hi All: I know this is simple, but I just can't seem to get there: I need to sort a table by a text field (txtDescription), then assign sequential numbers to the field SEQUENCE in table. ...
2
by: Deniz Bahar | last post by:
Hi, I'm working with a single linked list and want to delete elements by searching through the list (starting form the HEAD) then finding the element, then doing the following: NewElement =...
26
by: Brett | last post by:
I have created a structure with five fields. I then create an array of this type of structure and place the structure into an array element. Say index one. I want to assign a value to field3 of...
8
by: Sergei | last post by:
Hi, I am displaying modal dialog and passing values from the main form to the modal dialog and back. It works fine but if I used the following syntax on Page_Load(just for testing) in VB to...
4
by: Diego | last post by:
Hi everybody! I wonder if there is an sql command that increases a sequence value by one and returns such a value. I would like to manage an id inside a program that connects to the database...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
12
by: Danny Colligan | last post by:
In the following code snippet, I attempt to assign 10 to every index in the list a and fail because when I try to assign number to 10, number is a deep copy of the ith index (is this statement...
9
by: raylopez99 | last post by:
Just an observation: pens for drawing lines in Win Forms are tricky when assignment is inside the paint handler. inside of the Paint handler, but not inside a "using" brace (that is, outside of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.