Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform contents limited by other subform

Status
Not open for further replies.

Delindan

MIS
May 27, 2011
203
0
0
US
I have two tables with a one to many relationship based on a field position number. I would like to create a form that has two subforms. The first would be a simple table view of table 1 and the second would be a table view the related records in table 2 of the record highlighted in the first. Any help would be appreciated. Thanks
 
I just explained this in thread702-1679088
 
So I'm working with what you posted trying to get it to work and getting a syntax error. Here is what I have: 1 hidden text box called txtbxlink
1 subform called HCSelect with a record source of table.Head Count
on the event tab for it's properties I only see on enter or on exit. I don't see on current event. Nevertheless I created the following code:
Private Sub HCSelect_Current()
Me.Parent.txtbxLink = [Position Number]
End Sub
1 subform called JASelect with a link master: [txtbxlink] and link child: Me.[Position Number]

Any ideas? Thanks
 
I'm sure this seems really simple but for whatever reason I have trouble and get confused over the properties. Is there anywhere I can see a physical example of this that I can click around on to see...I think that would help. Thanks!
 
You need to double-click the little square box in the upper left corner of the subform. This should allow you to view the form properties of the subform and find the On Current property.

Duane
Hook'D on Access
MS Access MVP
 
The example is good...thanks. Just helps to actually see and touch something. I have a couple of questions. The source object of all three subforms is the name of the subform. I dont' understand that. The other thing is I found the on current of the "form" and there is nothing in there. I can't find the code part. The form that is supposed to have the On current code is the overall form, as opposed to the primary subform (the one that is controlling what the other subforms display...right?

Thanks!
 
No the main form is unbounded. The top form is a continous subform and the other subforms link to it.

The code is in the first subform. You pick an order and it sets the value on its on current event. The second subform shows the specifics on that order. The third shows the order details for that order. You could put the code in the main form, but that requires a trick. You would have to use WithEvents to capture the oncurrent event of the subform. Not worth the effort and gives you nothing.

The source object of a subform control is the form or query that is in the subform control. What are you expecting to see?
 
My explanation will just reveal my stupidity here, however here it goes. When I go into the properties of the first (controlling) subform, there is not a "on current" in the events. When I click on view code there is nothing there. I expected to see a data source in the source object which is obviously wrong...so a table or query.
 
There is a subform control, and then there is the thing inside the subform control. People often do not clearly diffentiate. If you click on the outside you get the properites of the control. If you click inside you select the form. Click the square in the upper right corner. My guess is you are on the control.

Inside a subform control has a source object property which can be a form, query, or table.

The form inside the subform control then has a rowsource like any other form.
 
IMG
 
The looks like the left...however I found it! Thanks for that
 
Sorry for being so dense. That was my whole problem. There was something weird about my subforms also. I deleted them and recreated and took the wizard through rather than creating them myself. There must have been something weird I was doing when I created them. This makes me think I need some basics on forms. I think it would go a long way in helping. I would love it if there was a faq that you could recommend. thanks again for the help!
 
When working with the subform wizard, it can be a pain. It is not well designed. I do not think the subform wizard will even allow you to do this. It only allows you to link a bound main form to a subform, when in fact you can do a whole lot more. Therefore, I never use wizards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top