ChrisSedgwick
Registered User.
- Local time
- Today, 00:26
- Joined
- Jan 8, 2015
- Messages
- 119
Hi,
I'm trying to create a simple command button that will generate a sequential number using the DMAX function. The database will be used only by one user so I wont have the issue of 2 users attempting to use the same number.
I've spent some time looking through this forum to try and find the one that relates to my issue.
So at present I have a table - "Fitter Order" which contains the following fields:
FitterOrderID (PK)(Auto)
OrderNo
Fitter
InputDate
Product ID (FK)
I want the "OrderNo" field to generate a sequential number on the click of a button at form level. I've uploaded some images so you can get an idea of the form and what I'm trying to achieve.
I'm using the DMAX function only on the advice of other forums and some theads on here. However if there's an easier way, I'm open to that. I've never really used VBA, so if this is needed, I'd appreciate it if you could make it as simple as possible to follow.
In the form I have a text box which is bound to the OrderNo field. I've included a command button with an event procedure when the button is clicked. This is the code I have behind it which I copied off another thread.
However when I try to leave the module, I receive the following error message:
"Compile error: Expected list separator" (Again, I have uploaded images.)
I'm kind of stuck now and I'm not sure when to being troubleshooting the issue. Could someone offer some support?
Many thanks,
I'm trying to create a simple command button that will generate a sequential number using the DMAX function. The database will be used only by one user so I wont have the issue of 2 users attempting to use the same number.
I've spent some time looking through this forum to try and find the one that relates to my issue.
So at present I have a table - "Fitter Order" which contains the following fields:
FitterOrderID (PK)(Auto)
OrderNo
Fitter
InputDate
Product ID (FK)
I want the "OrderNo" field to generate a sequential number on the click of a button at form level. I've uploaded some images so you can get an idea of the form and what I'm trying to achieve.
I'm using the DMAX function only on the advice of other forums and some theads on here. However if there's an easier way, I'm open to that. I've never really used VBA, so if this is needed, I'd appreciate it if you could make it as simple as possible to follow.
In the form I have a text box which is bound to the OrderNo field. I've included a command button with an event procedure when the button is clicked. This is the code I have behind it which I copied off another thread.
Code:
[FONT=Tahoma]Me.Text24 = Nz(DMax(“[OrderNo]”,”Fitter Order”),0)+1[/FONT]
However when I try to leave the module, I receive the following error message:
"Compile error: Expected list separator" (Again, I have uploaded images.)
I'm kind of stuck now and I'm not sure when to being troubleshooting the issue. Could someone offer some support?
Many thanks,
Attachments
Last edited: