View Full Version : This should be easy, but...


daveUK
03-02-2002, 02:21 AM
I'm designing a database that allows users to serach, view and store digital photographs. The main form showing all the stored images is frmPhoto and works fine. I have a subform (Category/Photo subform) that is linked to frmPhoto using the Photo ID field (Primary Key) as a link and this displays all of the Categories of the Photos. This also works OK. My problem is the second subform, which displays the sub-categories(sub-category subform). It's linked to the Category/Photo subform so that everytime the Category changes, only the relevant sub-categories are displayed. i.e. when the user selects the category Nature on the 1st subform (main Category), the 2nd subform (sub-category) allows the user to choose either Animals or Scenery.
I've used the following code on the Change and GotFocus properties of the Category/Photo subform

[Forms]![frmPhoto]![Sub-Category subform].Requery

My problem is that the sub-category subform isn't 'remembering' the value that I choose for the Photo.
i.e. When I choose the Category 'Nature' and sub-category 'Scenery' for a Photo, the next time I open the main form (frmPhoto), the category 'Nature' is still there, but the sub-category 'Animals' is displayed. This is the first record for the category Nature and Scenery is the second.

Any ideas???

Dave

DBL
03-02-2002, 02:48 AM
If I understand you correctly, there is a problem with displaying the results of syncronised combo boxes in datasheet view.

I have a sample which I will send you. You need to show the bound field in the combo box (probably the Category ID No). You can have the Category as part of the combo box to assist user entry but when they make their selection, it's the ID number they need to see. In the underlying query for the subform add the categories table and link it to the main table by the Category ID No. Add the Category description field to the query grid and add that field to the subform. When you select the Category ID the category description will appear in the text field next to it.

It's just a visual problem Access is "remembering" your selections but it's the bound ID field it remembers not the description.

Maybe I have totally misunderstood you so you can post back.

The other think you could do is on the OnCurrent event of the form add

[Forms]![frmPhoto]![Sub-Category subform].Requery

[This message has been edited by DBL (edited 03-02-2002).]

daveUK
03-02-2002, 09:26 AM
DBL

Thanks for the reply and the sample database. I have the formview of your sample set up as 2 subforms (they're based on 2 seperate forms(i.e. frmCategory and frmSub-Category)) and they work fine. When I open the main form (frmPhoto), the 1st subform (frmCategory which is a continuous form) retains the values that the user has input. i.e. The photo can have the categories 'Family' and 'Holiday', but the 2nd subform (sub-category) doesn't retain the user value.

I realise that this is a very good desription of what I'm trying to acheive.

DBL
03-03-2002, 01:03 PM
Sorry Dave, I can't visualise what it is you are trying to achieve or what the problem is. Hopefully someone else might be able to help.