Display first record value in a msgbox

  • Thread starter Thread starter Lloyd
  • Start date Start date
L

Lloyd

One of the fields on my form requires a value. Before the user enters that
value, I want to display the last value used so they know what the next value
should be.

I have a query that gets the data I need from a table. The FIRST record in
that query is the value I want to display in a message box.

How do I capture that value from the first record in the query and from the
correct column and the put it into a message box?

thanks in advance!
 
Lloyd said:
One of the fields on my form requires a value. Before the user enters that
value, I want to display the last value used so they know what the next value
should be.

I have a query that gets the data I need from a table. The FIRST record in
that query is the value I want to display in a message box.

How do I capture that value from the first record in the query and from the
correct column and the put it into a message box?


You can retrieve the value in the query's first record by
using the DLookup function:

DLookup("[the field]", "the query")

Just make sure the query sorts the records to guarantee the
first record is the one you want.
 
You could use a combo query/SQL to pull last one and increment at the same
time or pull last and set Not In List property to Yes so they can edit.
 
That was it, thank you!!

Marshall Barton said:
Lloyd said:
One of the fields on my form requires a value. Before the user enters that
value, I want to display the last value used so they know what the next value
should be.

I have a query that gets the data I need from a table. The FIRST record in
that query is the value I want to display in a message box.

How do I capture that value from the first record in the query and from the
correct column and the put it into a message box?


You can retrieve the value in the query's first record by
using the DLookup function:

DLookup("[the field]", "the query")

Just make sure the query sorts the records to guarantee the
first record is the one you want.
 
Back
Top