Senin, 22 Februari 2021

[MSAccessProfessionals] How to make a form go to a record with a particular ID

I have created a form to display photos from various folders on my PC. The record source is a table as follows:
Name: Photos
Field Name, Data Type
ImageID, Autonumber
Folder, Text
Photo, Text
It contains 100 records e.g.
38, 14/07/2018, 13880718, PICT0001.JPG

This works fine when using the normal navigation buttons, but as there are so many records I have added a list box containing the years, each with the appropriate starting record ID, contained in a table as follows:

Name: FirstPhotoOfYear
Field Name, Data Type
Year, Text
1st photo ID, Number

5 records e.g.
2018, 38

So when I select 2018 in the list box, I want to make the form show the record with ID = 38. I thought it might help to add a text box (called Text13) on the form that shows the ID number produced by the list box (called List11). This shows the ID fine, using a suitable expression as its control source.
In code which operates when the list box is updated, I first use Text13.Requery, followed by DoCmd.FindRecord but without success. I don't know how to make it search just the ID field, or even if it's found anything, as the form does not change to a new record.

I await suggestions.
.




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115853): https://groups.io/g/MSAccessProfessionals/message/115853
Mute This Topic: https://groups.io/mt/80837015/3568969
Group Owner: MSAccessProfessionals+owner@groups.io
Unsubscribe: https://groups.io/g/MSAccessProfessionals/leave/6606618/577250336/xyzzy [sugeng.panjalu.access@blogger.com]
-=-=-=-=-=-=-=-=-=-=-=-

Tidak ada komentar:

Posting Komentar