goto previous record accordıng to date

B

Baybars

Hi There
I have a form with one textbox of each field of the data. I added 2
command buttons which assist to go through records (the code is
DoCmd.GoToRecord , , acPrevious and DoCmd.GoToRecord , , acNext
respectively).
My problem is, it scrolls the data according to primary keys assigned
by access, my need is to go through according to the dates. I set the
table to show always date field ascending, however this is not helping
in the forms.

Any help is very much appreciated.
By the way, I tried to search the posts, but I am unable to find
any...

Regards,
Baybars
 
N

Nikos Yannacopoulos

Baybars,

"I set the table to show always date field ascending..." Sorry, this just
doesn't work. It only applies to how the data is displayed in table
datasheet view. By nature, Access tables are just "buckets" you throw data
into, so they will "give it back" in PK order at best (that is if a PK
exists), no fancy sorting possibilities...

In order to secure that your form gets the data in the order you want it to,
you must create a simple query on the table, that does nothing more than
merely sort the data, and use that query as the recordseource for your form,
rather than the table directly.



HTH,

Nikos
 

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