Food menu database. Need help.

C

Clement DeCastro

I'm constructing a food menu database. What I want to do is have a drop
down menu and when a particular food item is clicked on, a picture of the
food item is shown as well as its ingredients. Any advice on how to start
this? I'm very new to Access (2000). I will appreciate any help on this
topic. Thank you.
 
H

Harry van Rijn

Clement, have you created a table allready ?
I think of one with fields: menu_id, menu_name, menu_picture (or a
filename reffeing to the picture) and so on.
Then create a form, and state that the records source for this form is
the table above.
If you use the form wizard, put all fields in the form (>>). Later you
can decide what to remove and what not.
Then one field in you form will be bound to menu_id. Convert this field
to a combobox (rightclick on it). Then in the properties of this combo
say in the data tab, that the row source is ..., yes click on the ...
and select the table above, and 2 fields: i.e. menu_id and menu_naam.
You will have 2 'columns' in your combo. Now in the format tab you set
'Column Count' to 2, and you set 'Column Widths' to: 0";1" (this last
item 'closes the curtain' for the menu_id column.
Well then their should also be a field on your form that holds a
picture. In the properties of this, in it's format tab, you see that
'Picture' is equivalent to the path some picture.
If your table is filled with values, you should see a picture when
displaying the form in 'View' mode.
Now th last thing, when you click on the combo, and select some other
item, you want to see the picture too, belonging to this selection.
To understand what's happening when you select something in the combo, I
tell you this: When the form appears at first time, the combo is only
filled with values from you table. When you make a selection in the
combo, only the item you selected, is displayed at the top, nothing more
is done. I.e. there is no 'link' between the 'pointer' in the combo and
the 'pointer' to your 'current record' in your table. This you have to
establish yourself by putting code in an event function, the AfterUpdate
event function of your combo. So put the form in the 'design' mode,
display the properties of the combo, select the events tab, and click
the ... of the AfterUpdate item. Say that you want to code. Now a VBA
window appears with the header an tail of the event function allready
there. Here you put your code with the help of which you first find the
record in your table corresponding with the selected line in the combo.
Then you must make this the current record. There is code for this in
this newsgroup, but wait a second and I will paste my code in this mail
for you.

'Move to the record selected in the control
Me.RecordsetClone.findfirst "[menu_id] = " & Me![menu_id]
Me.Bookmark = Me.RecordsetClone.Bookmark

I have this code also from this newsgroup. Please type everything as
above, i.e. the '[ ] !' otherwise it wouldn't probaly work. Also the
name of your combo should be menu_id. This will be ok, if you blindly
follow the form wizard. Don't think what happen behind the scenes.

Because now the recordpointer in your table is updates every time you
make a selection in your combo, you automatically get the proper picture.

Good luck, and read this newsgroup !
Harry
 

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