Display first record value in a msgbox

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!
 
M

Marshall Barton

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.
 
K

KARL DEWEY

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.
 
L

Lloyd

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.
 

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