Getting the MAX of a field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a Database called Bookings.mdb. I have a table called Tbl_bookings.
I have a field called 'Booking_Number'.

I want to press a button on a form and for a message box to appear with the
MAX 'Booking Number'.

Simple for most but please help.
 
Hi,

I have a Database called Bookings.mdb. I have a table called Tbl_bookings.
I have a field called 'Booking_Number'.

I want to press a button on a form and for a message box to appear with the
MAX 'Booking Number'.

Simple for most but please help.

MsgBox "The highest booking number is " &
DMax("[Booking_Number]","Tbl_bookings")
 
For safety's sake, I would add to fredg, suggestion:

Nz(DMax("[Booking_Number]","Tbl_bookings"),0)

Also, if you want to create the next booking number

Nz(DMax("[Booking_Number]","Tbl_bookings"),0) + 1


fredg said:
Hi,

I have a Database called Bookings.mdb. I have a table called Tbl_bookings.
I have a field called 'Booking_Number'.

I want to press a button on a form and for a message box to appear with the
MAX 'Booking Number'.

Simple for most but please help.

MsgBox "The highest booking number is " &
DMax("[Booking_Number]","Tbl_bookings")
 
Back
Top