A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Filter the main form using the double clicked item in subform



 
 
Thread Tools Display Modes
  #1  
Old August 19th, 2004, 01:31 PM
Kirsty
external usenet poster
 
Posts: n/a
Default 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  
Old August 19th, 2004, 01:58 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

"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  
Old August 19th, 2004, 02:28 PM
external usenet poster
 
Posts: n/a
Default

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  
Old August 19th, 2004, 04:19 PM
Rick Brandt
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 02:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.