The next 1 record in a form

M

[MVP] S. Clark

It's hard to define what 'Next' really means in a database. If the records
are sorted by the primary key(which is an autonumber), then 'next' would be
the next highest number. But, what if the data is sorted by Last Name,
First Name, City? What is 'Next' then?

So, what is your definition of 'Next'?

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
G

giannis

I have a table with one only field.
I want (in the label) the next record (whatever) to
current record independently of the
order that field.
 
M

[MVP] S. Clark

Again, you've haven't stated what next is. Is next by data entry date,
numerical order ascending, and/or alphabetical descending?
Obviously this is important, or I wouldn't be braying about it.

You can do it with DLookup(). Suppose that 'Next' implies numerical
ascending order (1, 2, 3, etc)
Suppose a textbox named txtThisValue holds the current value, and that you
want to show the Next value in txtNextValue.

txtNextValue.controlsource = nz(Dlookup("Value", "TheTable", "Value > " &
txtThisValue),0)

Since you want to use a label(lblNextValue), in the On Current of the form
put
lblNextValue.caption = nz(Dlookup("Value", "TheTable", "Value > " &
txtThisValue),0)

I don't know what the timing will be as far as when txtThis value will get
populated, so results may vary.

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

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