473,395 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How To Link Subforms To Parent

[z{This post is in answer to a secondary question asked in:
Database Design Post #6}]
------------------------


Almost correct! The big picture isn't actually connected to the parts in the databse. The purpose of the big picture is to show the employee where to put the parts in the machine. Also small instructions like "Put grease here" are editted on the picture with MS Paint.

I'm new to subforms but It seems very logical to me so I'm going to give it a try. I will post an update if I stumble upon some difficulties or it's a succes.

Cheers!
Oct 24 '14 #1

✓ answered by Seth Schrock

Personally, I would think that you would want the combo box to stay spaced as they are so that it is easy to visually see which image corresponds to which combo box. In this type of situation, I would normally put the combo box in the middle of the form, which is also the middle of the image.

If you still want to have the combo boxes aligned closer to each other, I would recommend transferring the image controls to the parent form, make them unbound and have their names end with a 1, 2, 3 & 4 (for example Image1, Image2, etc). In your combo box's After_Update event, you will need to check which record number you have just edited and store this in a variable. You can then reference the appropriate image control like so:
Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer  'stores edited record number
  2. i = Me.CurrentRecord
  3.  
  4. Me.Parent.Controls("Image" & i).HyperlinkAddress = DLookup("ImagePath", "yourTable", "PartID = " & Me.ComboBox)
I haven't worked with image controls much, so I don't remember off the top of my head which property it is that you use to set the image path so I chose the HyperlinkAddress property. This assumes that you have linked images and not embedded images. You would then have to do something similar in the parent form's On_Current event so that it loads the proper images when you change records.

8 1392
Ok so now I have a MainForm with 4 subforms. Each subform has one textbox for Qty and one combobox with PartID and PartDescription as rowsource. To where should I set the controlsources for these boxes?

I also set the tblSteps as Recordsource for my Maintable. When I press the Add button a new record is added to this table.
Oct 24 '14 #2
Seth Schrock
2,965 Expert 2GB
You would only have one subform and make that form's Default View property to be either Datasheet or Continuous. This will allow you to see all four records at the same time. The subform would use the query that I posted in post #6 as it's recordsource.
Oct 24 '14 #3
Thanks Seth! I've got it working properly now! My next challenge is to see If I can isolate the ImageControl from the continuous subform. Currently, when I select a part, the image appears next to the combobox in an Image Control. Because it is a continous form, the layout is copied each time. But now I want to display the part images in a row with no spacing bewtween them.

The idea I've came up with is to create a 2nd continuous subform with only an ImageControl in it. The MainForm contains a (hidden) textbox which's Rowsource is the 3rd column of the Parts Combobox. The result is that the ImagePath of the part is displayed in the textbox.

Now I need to connect it to the ImageControl in the 2nd continuous form. The problem is, when I select a part in the 1st subform), the 2nd continuous form doesn't update and it doesn't move to a new record.

I hope this is possible or else I have to redesign my form completely.
Oct 28 '14 #4
Seth Schrock
2,965 Expert 2GB
When you say "in a row with no spacing between them", do you mean horizontally or vertically. It is simple to get the vertical spacing to be nothing. Simply place the image control at the very top of the detail section of the form and then shrink the size up to the bottom of the image control. When viewed with data, all the images will be stacked perfectly one on top of the other.

If you want them horizontally, I would say that it would probably be easiest to put them on the main form and then link them to the appropriate records in the subform via code.

While it is possible to connect two subforms, it takes a lot of code and I wouldn't recommend it for this situation. I would personally do them as I described in the first paragraph. You will save yourself a lot of headache.
Oct 28 '14 #5
I meant aligning them vertically.

This is the current situation:

Alignment Comboboxes and Image Controls.jpg

The continuous form within the red box has the same height as the ImageControl (both 0.58"). If I select a new part the Images apear directly underneath each other, which is exactly what I want. But the comboboxes need to be aligned closer to each other.
Oct 29 '14 #6
Seth Schrock
2,965 Expert 2GB
Personally, I would think that you would want the combo box to stay spaced as they are so that it is easy to visually see which image corresponds to which combo box. In this type of situation, I would normally put the combo box in the middle of the form, which is also the middle of the image.

If you still want to have the combo boxes aligned closer to each other, I would recommend transferring the image controls to the parent form, make them unbound and have their names end with a 1, 2, 3 & 4 (for example Image1, Image2, etc). In your combo box's After_Update event, you will need to check which record number you have just edited and store this in a variable. You can then reference the appropriate image control like so:
Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer  'stores edited record number
  2. i = Me.CurrentRecord
  3.  
  4. Me.Parent.Controls("Image" & i).HyperlinkAddress = DLookup("ImagePath", "yourTable", "PartID = " & Me.ComboBox)
I haven't worked with image controls much, so I don't remember off the top of my head which property it is that you use to set the image path so I chose the HyperlinkAddress property. This assumes that you have linked images and not embedded images. You would then have to do something similar in the parent form's On_Current event so that it loads the proper images when you change records.
Oct 29 '14 #7
You Sir, are my hero! Instead of using ".HyperlinkAddress"I used ".Picture" to set the controlsource for the ImageControl. By using the unbound ImageControls I can place them wherever I want on the main form. Thanks!
Oct 29 '14 #8
Seth Schrock
2,965 Expert 2GB
Glad I could help. Good luck on the rest of your project.
Oct 29 '14 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Farooq Karim | last post by:
Greetings; I am unable to solve this problem; I hope someone will come up to show his brilliance. From my web page I open another link in another browser window. That new window is composed...
3
by: Chris Wilkinson | last post by:
Hi there, I'm creating a frames website, which consists of a nav bar down the left of the screen (name="frame1") and a content frame filling the right hand side (name="frame2"). I've used nice...
2
by: dannielum | last post by:
Hi all, I am trying to write a Binary Search Tree that each of its node will have 3 node pointers: left, right and parent. I need a parent pointer for some the purpose of my project. Without the...
9
by: Zeeshan Iqbal via AccessMonster.com | last post by:
hi, im trying to design a form with two subforms. subforms no.1 (orders) is connected to the main form by customer ID and i dont know how i can connect another subform (order details)to the first...
3
by: Mark | last post by:
I have a link on Parent.html which brings up Child.html in a separate browser window. Child.html has a button with Javascript to close itself. Is there a way I can cause Parent.html to be...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform relates to the main form using an identity key (this works). The second subform relates to both the main and first subform. But I want to...
3
by: 6afraidbecause789 | last post by:
Think school - students - discipline interventions - misbehaviors - staff for this one....On a mainform frmStudentInterventions, I have linked a subform (sfrmMisbehaviors) with another subform...
1
by: varunvashishth | last post by:
hi, I'm facing a problem with displaying a child jsp on top of parent jsp. on clicking a link in parent jsp the child jsp opens up and it has some list of values and other textboxes which gets...
1
by: btreddy | last post by:
Hii all.., I have one query not able to find a solution. I've one javascript page(parent)on which upon clicking one link it willopen one more page(child page). here my question is how to...
1
by: whowell | last post by:
Hi I'm having a problem with my parent/child window relationship and the firefox browser My parent page "P" has a list of students on it and opens the child page "C" with a selected student's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.