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

linking a command button to a text box

I have a text box for receipt numbers RecNo on a form that is not an autonumber. I have another text box at the top of my form with this =DMax("RecNo","Payment record")+1 which shows me the next receipt number available. The purpose of this is so i can see straight away the next receipt number to enter on my form. I would like to create a command button that when clicked enters the next available receipt number in RecNo. That may not sound very clear! Hope someone can help.
Nov 23 '20 #1
1 1696
cactusdata
214 Expert 128KB
Use the BeforeInsert event of the form, and the number will be entered automatically when you start entering data in the new record:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeInsert(Cancel As Integer)
  2.     Me!RecNo.Value = DMax("RecNo", "[Payment record]") + 1
  3. End Sub
Nov 24 '20 #2

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

Similar topics

6
by: deko | last post by:
I have a several forms that accept user input in a textbox and then take some action based on that input after a command button is clicked. Is it possible issue the command when the user presses...
0
by: Lauren Quantrell | last post by:
I use the following code to create text edit fields and command buttons in my toolbars: Function CreateToolbarObject(myObjectType as integer) Dim newObject Select Case myObjectType Case 1...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
2
by: danthrom | last post by:
Hi all, I am trying to hid a command button which links two forms. The forms are connected by a one-to-many relationship and the second form has details on the first. But if no details are...
0
by: aviklund | last post by:
Hi, I made a simple data access page with a search button that does work properly, but now I would like to add a filtering to the command button also. Ideal solution would be like this: ...
7
by: support | last post by:
Hi, I am trying to change the text of a Command button using the Windows API Function SetWindowText, which I have declared as follows: <DllImport("User32")_ Public Function...
6
vdraceil
by: vdraceil | last post by:
How to link a command button to an .exe file? To be more clear, when a command button is clicked,a .exe file must bemade to open..
2
by: luciegiles | last post by:
Hi, I am creating a database in which users will enter details for one client (record) in several tables via several associated forms. I would like to have a button on each form that takes the...
1
by: jake1856 | last post by:
I am extremely novice access user and am having trouble linking the MuliSelect List Box to the command button to populate a table.
2
by: state90 | last post by:
I have a form with required fields. In order to force these requirements on the user I use a message box to alert the user of the requirement followed by a SetFocus back to the required text field....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.