Newbie - updating feilds based on value of another (1 Viewer)

ChrisC

Registered User.
Local time
Today, 01:17
Joined
Aug 13, 2019
Messages
90
Hi all,

First post but I am trying to muddle my way through Access and getting stuck on the first hurdles – so after a bit of advice.

All I want to do at the moment is have a VERY simple image database, where I have a table of parts (PartID, Description, Imagepath) and a form that people open, EITHER select the PartID from combobox or type it in and then the corresponding description appears in one text field, and the image path in another; with the image of the item appearing in the image field.

I have attached where I am at the moment. I can get the correct image and description to appear, but only for the first item in the combobox list. I just cant work out how to update the form Description and Image Path fields when I select the other combobox item, in order to therefore update the image shown. Also, if I type in the combobox, the record appears to get changed as well.

I have looked at DLookups but am getting myself a bit confused with just where to put the code; not even sure if that’s the correct thing to use! So please forgive my total ignorance, but any help would be gratefully received. If someone can tell me what search term would be best for me to search for on this website (to save having another thread about something that may have been answered 100 times before), please point me in that direction and I will follow! J

Many thanks for your time and help,
Chris
 

Attachments

  • imageDB.zip
    1.8 MB · Views: 79

ChrisC

Registered User.
Local time
Today, 01:17
Joined
Aug 13, 2019
Messages
90
Hi Colin,

Thanks very much for that - that's great! thank you!

Is there a way to add a separate description field and a search function (for both partID and description keyword)?

kind regards
Chris
 

June7

AWF VIP
Local time
Yesterday, 17:17
Joined
Mar 9, 2014
Messages
5,490
If you want combobox to serve as a search tool, it must be UNBOUND so you don't alter data in record when selecting item from list and then need some code - otherwise use the intrinsic search/filter tools from ribbon or right click menu.

Form is bound to table so just bind controls to fields, no need for DLookup().

Use image frame ControlSource property to dynamically display images. Just set this property to the file path field. And remove the embedded image from Picture property.

Colin's sample db will probably demonstrate all this.
 

isladogs

MVP / VIP
Local time
Today, 02:17
Joined
Jan 14, 2017
Messages
18,253
If there is a description attached to the file properties, you could show this in the same way the file size and date created properties are shown.
Or you could have a table with the image names and descriptions as separate fields.

You could also add a combo to search by file name, ID or whatever.
If you want the combo to search several fields, have a look at Allen Browne's example http://allenbrowne.com/ser-62.html
 

ChrisC

Registered User.
Local time
Today, 01:17
Joined
Aug 13, 2019
Messages
90
Thanks both!

I will have a play around... wish me luck! :)
 

ChrisC

Registered User.
Local time
Today, 01:17
Joined
Aug 13, 2019
Messages
90
I think im slowly getting there, by amending Allen Brownes example for my own needs. thanks again for the link :)

I'll mark as Solved and keep at it!
 

Users who are viewing this thread

Top Bottom