473,657 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assign next sequence # inside a form

2 New Member
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 2508
NeoPa
32,568 Recognized Expert Moderator MVP
When assigning a number, use DMax() of existing records then add 1.
Nov 3 '06 #2
Bjesparz
2 New Member
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 Recognized Expert Top Contributor
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
1807
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 in the field instead of the symbol it represents. The following example produces these results on Opera 8.5 and IE 6.0 I am expecting the same results whichever way I set the contents of "myText". Why, when choosing "function" does "&copy"...
14
12031
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. Every time a new record is added, the all SEQUENCE #'s must be reset. The re-numbering will be triggered by an EXPORT button.
2
1752
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 = CurrentElement->next; CurrentElement->next = NewElement->next->next; free(NewElement);
26
7065
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 the structure inside the array. When I try this, an error about late assignment appears. Is it possible to assign a value to a structure field that is in an array? I'm currently getting around the problem by creating a new structure, assign...
8
7393
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 assign value form the object to text Box it gives error 'Object required' Dim strResponse As String strResponse = strResponse & "<script language=""JavaScript"">" & vbCrLf strResponse = strResponse & "var aForm; " & vbCrLf
4
59736
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 through jdbc. I know that there is a command like: select next value for public.id_seq but this is not complete.
6
2259
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 = ds.Tables("mmsSpecRecord").Rows(0)("Q1") txtQ2.Text = ds.Tables("mmsSpecRecord").Rows(0)("Q2") ..... txtQ10.Text = ds.Tables("mmsSpecRecord").Rows(0)("Q10") ------code ------- Dim field As String = "Q"
12
2082
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 correct?). .... number = 10 .... So, I have to resort to using enumerate to assign to the list:
9
2353
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 "using { Pen mypen = new Pen(Color.Black, 1)) {}), which I think makes a difference: I find the following assignment does not work: //myPenTest instantiated in the normal constructor, as was baseline,
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.