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
|
|||
|
|||
Filter the main form using the double clicked item in subform
Hi
I have a form (frmInsufficientCrew) which contains a subform (fsubInsufficientCrewToday). The main form is mainly for data entry into the table (tblInsufficientCrew). The subform is based on a query filtered on date(qryInsufficientCrewToday) which displays a subset of the fields in the main form. I want to be able to double click on an item in the subform query and the main form should jump to that record. The obvious way to me seemed to assign the following macro to the double click property of the fields in the subform: Action:ApplyFilter Where Condition: [Forms]![frmInsufficientCrew]![IC_ID]= [Forms]![fsubInsufficientCrewToday]![IC_ID] However, this results in a pop up to Enter Paramater Value Forms!fsubInsufficientCrewToday!IC_ID What am I doing wrong or is there a better way of doing this? (I am still very inexperienced, so sorry if its very trivial!) Thanks in advance to anyone who can help! Kirsty |
#2
|
|||
|
|||
"Kirsty" wrote in message
... Hi I have a form (frmInsufficientCrew) which contains a subform (fsubInsufficientCrewToday). The main form is mainly for data entry into the table (tblInsufficientCrew). The subform is based on a query filtered on date(qryInsufficientCrewToday) which displays a subset of the fields in the main form. I want to be able to double click on an item in the subform query and the main form should jump to that record. The obvious way to me seemed to assign the following macro to the double click property of the fields in the subform: Action:ApplyFilter Where Condition: [Forms]![frmInsufficientCrew]![IC_ID]= [Forms]![fsubInsufficientCrewToday]![IC_ID] However, this results in a pop up to Enter Paramater Value Forms!fsubInsufficientCrewToday!IC_ID What am I doing wrong or is there a better way of doing this? (I am still very inexperienced, so sorry if its very trivial!) A form being displayed within a subform control is not considered "open" and is therefore not a member of the Forms! collection (which only contains open forms). You have to use the following syntax... Forms!NameOfParentForm!NameOfSubformControl.Form!C ontrolOrFieldName Two notes he The name of the subform *control* is usually the same as the form contained within, but that is not always the case. The syntax above requires the name of the control, not the form. Take note of the "dot-Form" after the name of the subform control. Easy to miss and it has to be there. -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com |
#3
|
|||
|
|||
Thanks for that Rick, thats got rid of the 'Enter
Parameter' pop up... However... now it gives you a new record in both the main form and in the subform! This is my revised where condition: [Forms]![frmInsufficientCrew]![IC_ID]=[Forms]! [frmInsufficientCrew]![fsubInsufficientCrewToday].[Form]! [IC_ID] -----Original Message----- A form being displayed within a subform control is not considered "open" and is therefore not a member of the Forms! collection (which only contains open forms). You have to use the following syntax... Forms!NameOfParentForm!NameOfSubformControl.For m! ControlOrFieldName Two notes he The name of the subform *control* is usually the same as the form contained within, but that is not always the case. The syntax above requires the name of the control, not the form. Take note of the "dot-Form" after the name of the subform control. Easy to miss and it has to be there. -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com . |
#4
|
|||
|
|||
wrote in message
... Thanks for that Rick, thats got rid of the 'Enter Parameter' pop up... However... now it gives you a new record in both the main form and in the subform! This is my revised where condition: [Forms]![frmInsufficientCrew]![IC_ID]=[Forms]! [frmInsufficientCrew]![fsubInsufficientCrewToday].[Form]! [IC_ID] Going to a new record is Access' normal behavior when applying a filter with no matches found so it appears that there is still a problem with the syntax. It's possible you need to delimit the filter string so it uses the value found in the subform rather than using the subform reference directly. I would do this in code rather than a Macro and I am not well-versed in Macro usage. The code would look like... Me.Parent.Filter = "[IC_ID]=" & Me![NC_ID] Me.Parent.FilterOn = True -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
dlookup | miaplacidus | Using Forms | 9 | August 5th, 2004 09:16 PM |
Refreshing my main form from a subform | Narwe | General Discussion | 1 | July 22nd, 2004 12:05 PM |
How can I put a Tabular Subform in a Tabular Main form? | Mike | Using Forms | 2 | July 13th, 2004 09:39 PM |
Need to make a Tabular Subform in a Tabular Main Form.... | Mike | Using Forms | 1 | July 13th, 2004 07:53 PM |
Filter Problems on Main form & Subform | Jeff | Using Forms | 2 | July 7th, 2004 03:13 PM |