Find a record in a table, based on a criteria, and use it in another form

  • Thread starter Thread starter Justin
  • Start date Start date
J

Justin

Hi All,

I have a form that needs to find the next available order number (located in
table OrderNumber) and use it in the form when adding a new order.

I need to know the following please;

-how to open the table from the form
- find the last unassigned order number (field = ordernumber and criteria is
Lastused = 0)
- use the ordernumber found in the form.

Any help really would be appreciated.

Thanks!!!
Justin
 
Assuming that the ordernumber is a number and not text, check out the DMin or
maybe DMin functions. Do not be tempted by the DLast or DFirst functions.
The lead to the dark side....
 
Justin,

You could possibly use the Default Value property of the OrderNumber
control on your form for this. Just set it to...
DMax("[OrderNumber]","YourTable")+1
But I am not sure about this, as I don't understand your reference to
"Lastused=0". Maybe it would clarify if you could give an example.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top