I have a NewCustomer form tied directly to the table Customer. This form is set to open in Data entry mode. The AccNo field is a text field that has either a 650000 number for account customers or a C00000 number for cash sale customers.
I have a list box squashed to show only one value that shows the last C number entered using the row source as:
SELECT Customer.AccNo FROM Customer WHERE (((Customer.AccNo) Like “C0????”)) ORDER BY Customer.AccNo DESC;
The salesmen are allowed to put up new customers as cash sale accounts only, and at the moment they manually type in the next C number from the one shown.
I have attempted to automate this step by doing the following:
Dim begin, finish, cnt
begin = “C00000”
finish = Right(Listbox.Value, 5)
finish = finish + 1
cnt = Len(finish)
AccNo.Value = Left(begin, 6 – cnt) & finish
on formload but I have found that the listbox has no value until a value in the box is clicked, so I get a null error and the process is not automatic.
How can I achieve having the form open into Dataentry mode with the next C number in position?
Regards, Allan