Display highest number?

M

Marie

Hi,

I have a 97 database with a form (frmInput) linked to a
table (tblData) that has several fields: ID, Type, Order,
and Code.
ID = Type+Order, where Type is a choice of three (A,B,C)
and Order is an integer. When I open frmInput, I would
like to see (in a subform?) the highest Order number for
each of the three Types (to help avoid inputting duplicate
information). So, ideally, when I open the frmInput, the
subform(s) would read A87, B66, C103, for example.
('Count' queries won't work as some records have been
deleted retrospectively.) Does this make sense?

Is there an easy way to do this? Any help would be much
appreciated.

many thanks and kind regards,

Marie
 
R

Ronald W. Roberts

Marie said:
Hi,

I have a 97 database with a form (frmInput) linked to a
table (tblData) that has several fields: ID, Type, Order,
and Code.
ID = Type+Order, where Type is a choice of three (A,B,C)
and Order is an integer. When I open frmInput, I would
like to see (in a subform?) the highest Order number for
each of the three Types (to help avoid inputting duplicate
information). So, ideally, when I open the frmInput, the
subform(s) would read A87, B66, C103, for example.
('Count' queries won't work as some records have been
deleted retrospectively.) Does this make sense?

Is there an easy way to do this? Any help would be much
appreciated.

many thanks and kind regards,

Marie
Try this. put this in the form Open event.

Dim iOrderA As Long
Dim txtOrderA As String


if IsNull(DMin("[Order]", "tblData", "[Type] = 'A'")) then
iOrderA = 0
Else
iOrderA = DMin("[Order]", "tblData", "[Type] = 'A'")
Endif
txtOrderA="A" & iOrderA

Ron
 

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

Top