If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Photos and subforms
I have a main form with individuals info. The subform contains christmas
ornaments - in datasheet view -which belong to the indvidual on main form. I have a form that links a jpeg photo of the ornament. I can make the photo form a subform but it is linked only to main form. I want the photo to display on the main form but show the picture of the record selected in the other subform - the list of ornaments. Thanks for any help |
#2
|
|||
|
|||
Photos and subforms
In a sense, what we need to do is fool the second subform.
1) On the main form place an unbound txtbox named something like selectedOrnamentKey. 2) In the OnCurrent event of the first subform (the list of ornaments) add code such as forms![MainFormName]![Form]![SelectedOrnamentKey] = me.OrnamentKey 3) On the second subform, in the form property locate the Master Child properties on the Data Tab In the Master property place selectedOrnamentKey In the Child property place the name of the field that links the two Ron |
#3
|
|||
|
|||
Photos and subforms
the second subform of the pictures is created and responds but does not have
a master / child property in properties window "Ron2006" wrote: In a sense, what we need to do is fool the second subform. 1) On the main form place an unbound txtbox named something like selectedOrnamentKey. 2) In the OnCurrent event of the first subform (the list of ornaments) add code such as forms![MainFormName]![Form]![SelectedOrnamentKey] = me.OrnamentKey 3) On the second subform, in the form property locate the Master Child properties on the Data Tab In the Master property place selectedOrnamentKey In the Child property place the name of the field that links the two Ron |
#4
|
|||
|
|||
Photos and subforms
Sorry got to the master and child property but still cannot change property
to recognize the unbound text box in the list "Ron2006" wrote: In a sense, what we need to do is fool the second subform. 1) On the main form place an unbound txtbox named something like selectedOrnamentKey. 2) In the OnCurrent event of the first subform (the list of ornaments) add code such as forms![MainFormName]![Form]![SelectedOrnamentKey] = me.OrnamentKey 3) On the second subform, in the form property locate the Master Child properties on the Data Tab In the Master property place selectedOrnamentKey In the Child property place the name of the field that links the two Ron |
#5
|
|||
|
|||
Photos and subforms
Are you trying to use the wizard or are you entering the items in
manually? The wizard does NOT have to be used (although if the form is mainform is bound i should work). Are you sure you have moved the value from subform1 to the unbound txtbox. Usually I make that txtbox NOT visible but only AFTER testing is complete and I know it is working. Ron |
#6
|
|||
|
|||
Photos and subforms
Sorry I've been gone no access online.
I had to change the layout for various reasons but still have the same problem. I could not get your suggestions to work but was probably inserting incorrectly. My situation now is I still have a mainfrom "Individuals". On this form it simply shows the individuals name in the form header. I have a subform "Individuals subform" it displays details of Christmas ornaments -ie Name, description, Comments, A photo, etc. on the Indivdual subform I have another form "Ornaments1" It basically is a datasheet view of info from the same table (Ornaments Table) as the ind. subform data comes from. This datasheet form displays only the ornament year and Ornament name. I want to be able to look at an individual in the main form - see a list of all their ornaments. Click on an ornament in the list and see the details of that ornament. All the info described would be seen in one form / subforms all at one time. Not via opening other forms. The Ornaments1 list is linked to the main form key "Individual Id" and it shows a list of all the ornaments belonging to the individual record in the main. The individuals subform is also linked to the mainform key "individual Id" and it shows all appropriate data. This all works fine for the first ornament for each individual. Obviously when I select another ornament in the list the detailed info part of the form remains on the first ornament. I need to link the ornament list to the main form via the "individual Id" as a child and I need to link the ornament list to the individual subform via the "ornament Id" as a Master. Can you link a subform to two different forms - one as a master and one as a child? Or do I need to approach this in a different way? Thanks for your help! "Ron2006" wrote: Are you trying to use the wizard or are you entering the items in manually? The wizard does NOT have to be used (although if the form is mainform is bound i should work). Are you sure you have moved the value from subform1 to the unbound txtbox. Usually I make that txtbox NOT visible but only AFTER testing is complete and I know it is working. Ron |
#7
|
|||
|
|||
Photos and subforms
I believe what I have described will work. I have done it myself and
it does work. Here it is again. 1) On the main form place an unbound txtbox named something like selectedOrnamentKey. 2) In the OnCurrent event of the first subform (the list of ornaments) add code such as forms![MainFormName]![Form]![SelectedOrnamentKey] = me.OrnamentKey 3) On the second subform, in the form property locate the Master Child properties on the Data Tab In the Master property place selectedOrnamentKey In the Child property place the name of the field that links the two The real key to the logic is that BOTH subforms THINK they are linked to the main form. Subform 1 ("Individuals subform" ) can be linked via the wizard but in either case the parent / child relationship points to "Individual Id" as the linking mechanism. ON the main form you will also need to place an unbound field (it can and probably should be hidden) This will contain the ID of the subform 1 record. In the ONCurrent event of subform 1 move the unique id (whatever else that subform 2 needs) to match with to this unbound field on the main subform. Subform 2 ("Ornaments1" ) In the parent child fields of the form properties place BOTH field names (separated by a semi-colon) that constitues the matching criteria. Ron |
Thread Tools | |
Display Modes | |
|
|