populate field using next available number

clare_voiant

Board Regular
Joined
Mar 20, 2002
Messages
76
Hi,

I have a lookup table containing consecutive numbers and a yes/no box to say whether or not the number has been issued already.

It is important that the numbers are issued in order and that all the numbers are issued.

I would like to be able to either select (using a combo box) the next unissued number (then mark it as issued) OR to be able to use a button command to 'get number' to get the next previously unissued number and then mark it issued.

My coding is limited. please help.

many thanks

Clare

:rolleyes:

thanks Clare
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
to get the highest number used you can use the Dmax function. You would not normaly mark a number as used, if exists it has been used! just find the highest number used and add one.

in a form that uses the number you can set it default value using the Dmx() function and it will add the next number when the record is created
=DMax("[ID Field]","[Your Table]")+1

This will only work on a single user form as in a multiple user set-up more than 1 person may try to add records at the same time.

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,798
Messages
6,162,027
Members
451,737
Latest member
MRASHLEY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top