Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Specification of multiple link criteria

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Specification of multiple link criteria
RoBo 05.09.2006 13:37:01
I am having a problem. From a selection from, I display a list of records
that meet one link field. From the shown list I would like to select a record
but this record can only be selected by using two link-criteria [ID_CSS] and
[ID-Lid]. How do I specify this correctly in the stLinkCriteria field?

Thanks for helping me out. in the Dutch forum nobody answered me.

Ron
Re: Specification of multiple link criteria
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 05.09.2006 14:18:09
The basic idea is to put the 2 parts together with AND between them.
Brackets are optional, but can help.

This example assumes both fields are of type Number (not Text), and you have
text boxes on the form that supply the values:
stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = " &
[ID-Lid] & ")"

If it doesn't work correctly, make this the next line:
Debug.Print stLinkCriteria
Then when it fails, open the Immediate Window (press Ctrl+G), and see what
came out. It has to look exactly like the WHERE clause of a query. You can
mock up a query putting any values in the Criteria, and swith the query to
SQL View (View menu in query design) to see the WHERE clause.

If the fields are Text type, you need extra quote marks.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
[Quoted Text]
>I am having a problem. From a selection from, I display a list of records
> that meet one link field. From the shown list I would like to select a
> record
> but this record can only be selected by using two link-criteria [ID_CSS]
> and
> [ID-Lid]. How do I specify this correctly in the stLinkCriteria field?
>
> Thanks for helping me out. in the Dutch forum nobody answered me.
>
> Ron


Re: Specification of multiple link criteria
RoBo 05.09.2006 14:59:03
Hi Allen,

This does not seem to work. In the form in which I select a record (the form
is based on a query) the [ID_Lid] field contains the value of the first
record of the query. It should contain the value of the selected record in
that wquery. How do I set the value of the link field to the value [ID_Lid]
of the selected record?

Ron

"Allen Browne" wrote:

[Quoted Text]
> The basic idea is to put the 2 parts together with AND between them.
> Brackets are optional, but can help.
>
> This example assumes both fields are of type Number (not Text), and you have
> text boxes on the form that supply the values:
> stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = " &
> [ID-Lid] & ")"
>
> If it doesn't work correctly, make this the next line:
> Debug.Print stLinkCriteria
> Then when it fails, open the Immediate Window (press Ctrl+G), and see what
> came out. It has to look exactly like the WHERE clause of a query. You can
> mock up a query putting any values in the Criteria, and swith the query to
> SQL View (View menu in query design) to see the WHERE clause.
>
> If the fields are Text type, you need extra quote marks.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
> >I am having a problem. From a selection from, I display a list of records
> > that meet one link field. From the shown list I would like to select a
> > record
> > but this record can only be selected by using two link-criteria [ID_CSS]
> > and
> > [ID-Lid]. How do I specify this correctly in the stLinkCriteria field?
> >
> > Thanks for helping me out. in the Dutch forum nobody answered me.
> >
> > Ron
>
>
>
Re: Specification of multiple link criteria
RoBo 05.09.2006 15:16:02
The value should match the cursor position of the record selected on screen.

Ron

"RoBo" wrote:

[Quoted Text]
> Hi Allen,
>
> This does not seem to work. In the form in which I select a record (the form
> is based on a query) the [ID_Lid] field contains the value of the first
> record of the query. It should contain the value of the selected record in
> that wquery. How do I set the value of the link field to the value [ID_Lid]
> of the selected record?
>
> Ron
>
> "Allen Browne" wrote:
>
> > The basic idea is to put the 2 parts together with AND between them.
> > Brackets are optional, but can help.
> >
> > This example assumes both fields are of type Number (not Text), and you have
> > text boxes on the form that supply the values:
> > stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = " &
> > [ID-Lid] & ")"
> >
> > If it doesn't work correctly, make this the next line:
> > Debug.Print stLinkCriteria
> > Then when it fails, open the Immediate Window (press Ctrl+G), and see what
> > came out. It has to look exactly like the WHERE clause of a query. You can
> > mock up a query putting any values in the Criteria, and swith the query to
> > SQL View (View menu in query design) to see the WHERE clause.
> >
> > If the fields are Text type, you need extra quote marks.
> >
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > Tips for Access users - http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
> >
> > "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> > news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
> > >I am having a problem. From a selection from, I display a list of records
> > > that meet one link field. From the shown list I would like to select a
> > > record
> > > but this record can only be selected by using two link-criteria [ID_CSS]
> > > and
> > > [ID-Lid]. How do I specify this correctly in the stLinkCriteria field?
> > >
> > > Thanks for helping me out. in the Dutch forum nobody answered me.
> > >
> > > Ron
> >
> >
> >
Re: Specification of multiple link criteria
RoBo 05.09.2006 15:33:01
Extra info: The form consists of a main form and a sub form. Both forms are
based on the same query. Main form "Maintenace CSS" and subform "Selection
CSS".
Field to link: ID_CSS and ID_Lid.
To open the form "Maintenance Lid", I need the ID_CSS from "Maintenace CSS"
and the ID_Lid from the form "Selection CSS".

Ron

"RoBo" wrote:

[Quoted Text]
> The value should match the cursor position of the record selected on screen.
>
> Ron
>
> "RoBo" wrote:
>
> > Hi Allen,
> >
> > This does not seem to work. In the form in which I select a record (the form
> > is based on a query) the [ID_Lid] field contains the value of the first
> > record of the query. It should contain the value of the selected record in
> > that wquery. How do I set the value of the link field to the value [ID_Lid]
> > of the selected record?
> >
> > Ron
> >
> > "Allen Browne" wrote:
> >
> > > The basic idea is to put the 2 parts together with AND between them.
> > > Brackets are optional, but can help.
> > >
> > > This example assumes both fields are of type Number (not Text), and you have
> > > text boxes on the form that supply the values:
> > > stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = " &
> > > [ID-Lid] & ")"
> > >
> > > If it doesn't work correctly, make this the next line:
> > > Debug.Print stLinkCriteria
> > > Then when it fails, open the Immediate Window (press Ctrl+G), and see what
> > > came out. It has to look exactly like the WHERE clause of a query. You can
> > > mock up a query putting any values in the Criteria, and swith the query to
> > > SQL View (View menu in query design) to see the WHERE clause.
> > >
> > > If the fields are Text type, you need extra quote marks.
> > >
> > > --
> > > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > > Tips for Access users - http://allenbrowne.com/tips.html
> > > Reply to group, rather than allenbrowne at mvps dot org.
> > >
> > > "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> > > news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
> > > >I am having a problem. From a selection from, I display a list of records
> > > > that meet one link field. From the shown list I would like to select a
> > > > record
> > > > but this record can only be selected by using two link-criteria [ID_CSS]
> > > > and
> > > > [ID-Lid]. How do I specify this correctly in the stLinkCriteria field?
> > > >
> > > > Thanks for helping me out. in the Dutch forum nobody answered me.
> > > >
> > > > Ron
> > >
> > >
> > >
Re: Specification of multiple link criteria
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 05.09.2006 15:52:48
If the ID_CSS value needs to come from from the main form, you could try
this:
stLinkCriteria = "([ID_CSS] = " & Me.Parent![ID_CSS] & ") AND ([ID-Lid]
= " & Me.[ID-Lid] & ")"

Each form has a current record. The value referred to in the statement will
be from the current record of the form.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
news:9AF7D58D-59AD-400B-83C7-BCEF4785CC69[ at ]microsoft.com...
[Quoted Text]
> Extra info: The form consists of a main form and a sub form. Both forms
> are
> based on the same query. Main form "Maintenace CSS" and subform "Selection
> CSS".
> Field to link: ID_CSS and ID_Lid.
> To open the form "Maintenance Lid", I need the ID_CSS from "Maintenace
> CSS"
> and the ID_Lid from the form "Selection CSS".
>
> Ron
>
> "RoBo" wrote:
>
>> The value should match the cursor position of the record selected on
>> screen.
>>
>> Ron
>>
>> "RoBo" wrote:
>>
>> > Hi Allen,
>> >
>> > This does not seem to work. In the form in which I select a record (the
>> > form
>> > is based on a query) the [ID_Lid] field contains the value of the first
>> > record of the query. It should contain the value of the selected record
>> > in
>> > that wquery. How do I set the value of the link field to the value
>> > [ID_Lid]
>> > of the selected record?
>> >
>> > Ron
>> >
>> > "Allen Browne" wrote:
>> >
>> > > The basic idea is to put the 2 parts together with AND between them.
>> > > Brackets are optional, but can help.
>> > >
>> > > This example assumes both fields are of type Number (not Text), and
>> > > you have
>> > > text boxes on the form that supply the values:
>> > > stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = "
>> > > &
>> > > [ID-Lid] & ")"
>> > >
>> > > If it doesn't work correctly, make this the next line:
>> > > Debug.Print stLinkCriteria
>> > > Then when it fails, open the Immediate Window (press Ctrl+G), and see
>> > > what
>> > > came out. It has to look exactly like the WHERE clause of a query.
>> > > You can
>> > > mock up a query putting any values in the Criteria, and swith the
>> > > query to
>> > > SQL View (View menu in query design) to see the WHERE clause.
>> > >
>> > > If the fields are Text type, you need extra quote marks.
>> > >
>> > > "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
>> > > news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
>> > > >I am having a problem. From a selection from, I display a list of
>> > > >records
>> > > > that meet one link field. From the shown list I would like to
>> > > > select a
>> > > > record
>> > > > but this record can only be selected by using two link-criteria
>> > > > [ID_CSS]
>> > > > and
>> > > > [ID-Lid]. How do I specify this correctly in the stLinkCriteria
>> > > > field?
>> > > >
>> > > > Thanks for helping me out. in the Dutch forum nobody answered me.


Re: Specification of multiple link criteria
RoBo 05.09.2006 16:15:02
I get an error message saying that the expression entered has an invalid
reference to the Parent property.

Ron

"Allen Browne" wrote:

[Quoted Text]
> If the ID_CSS value needs to come from from the main form, you could try
> this:
> stLinkCriteria = "([ID_CSS] = " & Me.Parent![ID_CSS] & ") AND ([ID-Lid]
> = " & Me.[ID-Lid] & ")"
>
> Each form has a current record. The value referred to in the statement will
> be from the current record of the form.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> news:9AF7D58D-59AD-400B-83C7-BCEF4785CC69[ at ]microsoft.com...
> > Extra info: The form consists of a main form and a sub form. Both forms
> > are
> > based on the same query. Main form "Maintenace CSS" and subform "Selection
> > CSS".
> > Field to link: ID_CSS and ID_Lid.
> > To open the form "Maintenance Lid", I need the ID_CSS from "Maintenace
> > CSS"
> > and the ID_Lid from the form "Selection CSS".
> >
> > Ron
> >
> > "RoBo" wrote:
> >
> >> The value should match the cursor position of the record selected on
> >> screen.
> >>
> >> Ron
> >>
> >> "RoBo" wrote:
> >>
> >> > Hi Allen,
> >> >
> >> > This does not seem to work. In the form in which I select a record (the
> >> > form
> >> > is based on a query) the [ID_Lid] field contains the value of the first
> >> > record of the query. It should contain the value of the selected record
> >> > in
> >> > that wquery. How do I set the value of the link field to the value
> >> > [ID_Lid]
> >> > of the selected record?
> >> >
> >> > Ron
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> > > The basic idea is to put the 2 parts together with AND between them.
> >> > > Brackets are optional, but can help.
> >> > >
> >> > > This example assumes both fields are of type Number (not Text), and
> >> > > you have
> >> > > text boxes on the form that supply the values:
> >> > > stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = "
> >> > > &
> >> > > [ID-Lid] & ")"
> >> > >
> >> > > If it doesn't work correctly, make this the next line:
> >> > > Debug.Print stLinkCriteria
> >> > > Then when it fails, open the Immediate Window (press Ctrl+G), and see
> >> > > what
> >> > > came out. It has to look exactly like the WHERE clause of a query.
> >> > > You can
> >> > > mock up a query putting any values in the Criteria, and swith the
> >> > > query to
> >> > > SQL View (View menu in query design) to see the WHERE clause.
> >> > >
> >> > > If the fields are Text type, you need extra quote marks.
> >> > >
> >> > > "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> >> > > news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
> >> > > >I am having a problem. From a selection from, I display a list of
> >> > > >records
> >> > > > that meet one link field. From the shown list I would like to
> >> > > > select a
> >> > > > record
> >> > > > but this record can only be selected by using two link-criteria
> >> > > > [ID_CSS]
> >> > > > and
> >> > > > [ID-Lid]. How do I specify this correctly in the stLinkCriteria
> >> > > > field?
> >> > > >
> >> > > > Thanks for helping me out. in the Dutch forum nobody answered me.
>
>
>
Re: Specification of multiple link criteria
RoBo 05.09.2006 16:18:01
Allen,

The [ID_Lid] still refers to the first record of the recordset altough I
clicked in the record that I would like to maintain. The Parent reference is
solved.

Ron

"Allen Browne" wrote:

[Quoted Text]
> If the ID_CSS value needs to come from from the main form, you could try
> this:
> stLinkCriteria = "([ID_CSS] = " & Me.Parent![ID_CSS] & ") AND ([ID-Lid]
> = " & Me.[ID-Lid] & ")"
>
> Each form has a current record. The value referred to in the statement will
> be from the current record of the form.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> news:9AF7D58D-59AD-400B-83C7-BCEF4785CC69[ at ]microsoft.com...
> > Extra info: The form consists of a main form and a sub form. Both forms
> > are
> > based on the same query. Main form "Maintenace CSS" and subform "Selection
> > CSS".
> > Field to link: ID_CSS and ID_Lid.
> > To open the form "Maintenance Lid", I need the ID_CSS from "Maintenace
> > CSS"
> > and the ID_Lid from the form "Selection CSS".
> >
> > Ron
> >
> > "RoBo" wrote:
> >
> >> The value should match the cursor position of the record selected on
> >> screen.
> >>
> >> Ron
> >>
> >> "RoBo" wrote:
> >>
> >> > Hi Allen,
> >> >
> >> > This does not seem to work. In the form in which I select a record (the
> >> > form
> >> > is based on a query) the [ID_Lid] field contains the value of the first
> >> > record of the query. It should contain the value of the selected record
> >> > in
> >> > that wquery. How do I set the value of the link field to the value
> >> > [ID_Lid]
> >> > of the selected record?
> >> >
> >> > Ron
> >> >
> >> > "Allen Browne" wrote:
> >> >
> >> > > The basic idea is to put the 2 parts together with AND between them.
> >> > > Brackets are optional, but can help.
> >> > >
> >> > > This example assumes both fields are of type Number (not Text), and
> >> > > you have
> >> > > text boxes on the form that supply the values:
> >> > > stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid] = "
> >> > > &
> >> > > [ID-Lid] & ")"
> >> > >
> >> > > If it doesn't work correctly, make this the next line:
> >> > > Debug.Print stLinkCriteria
> >> > > Then when it fails, open the Immediate Window (press Ctrl+G), and see
> >> > > what
> >> > > came out. It has to look exactly like the WHERE clause of a query.
> >> > > You can
> >> > > mock up a query putting any values in the Criteria, and swith the
> >> > > query to
> >> > > SQL View (View menu in query design) to see the WHERE clause.
> >> > >
> >> > > If the fields are Text type, you need extra quote marks.
> >> > >
> >> > > "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
> >> > > news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
> >> > > >I am having a problem. From a selection from, I display a list of
> >> > > >records
> >> > > > that meet one link field. From the shown list I would like to
> >> > > > select a
> >> > > > record
> >> > > > but this record can only be selected by using two link-criteria
> >> > > > [ID_CSS]
> >> > > > and
> >> > > > [ID-Lid]. How do I specify this correctly in the stLinkCriteria
> >> > > > field?
> >> > > >
> >> > > > Thanks for helping me out. in the Dutch forum nobody answered me.
>
>
>
Re: Specification of multiple link criteria
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 06.09.2006 01:29:21
The expression should refer to the current row.

To verify this is the row you expect it to be, set the RecordSelectors
property to Yes for the subform. You then see a side-ways triangle in the
Record Selector pointing to the current row.

It could get reset to the first row after a Requery, or if the main form
moves record.

You can also verify which one is the current row by adding this line to the
code:
Debug.Print Me.[ID-Lid]
and checking in the Immediate Window (Ctrl+G) after it runs.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
news:663C9E7C-9656-4CE4-AD64-12D20406A490[ at ]microsoft.com...
[Quoted Text]
> Allen,
>
> The [ID_Lid] still refers to the first record of the recordset altough I
> clicked in the record that I would like to maintain. The Parent reference
> is
> solved.
>
> Ron
>
> "Allen Browne" wrote:
>
>> If the ID_CSS value needs to come from from the main form, you could try
>> this:
>> stLinkCriteria = "([ID_CSS] = " & Me.Parent![ID_CSS] & ") AND
>> ([ID-Lid]
>> = " & Me.[ID-Lid] & ")"
>>
>> Each form has a current record. The value referred to in the statement
>> will
>> be from the current record of the form.
>>
>> "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
>> news:9AF7D58D-59AD-400B-83C7-BCEF4785CC69[ at ]microsoft.com...
>> > Extra info: The form consists of a main form and a sub form. Both forms
>> > are
>> > based on the same query. Main form "Maintenace CSS" and subform
>> > "Selection
>> > CSS".
>> > Field to link: ID_CSS and ID_Lid.
>> > To open the form "Maintenance Lid", I need the ID_CSS from "Maintenace
>> > CSS"
>> > and the ID_Lid from the form "Selection CSS".
>> >
>> > Ron
>> >
>> > "RoBo" wrote:
>> >
>> >> The value should match the cursor position of the record selected on
>> >> screen.
>> >>
>> >> Ron
>> >>
>> >> "RoBo" wrote:
>> >>
>> >> > Hi Allen,
>> >> >
>> >> > This does not seem to work. In the form in which I select a record
>> >> > (the
>> >> > form
>> >> > is based on a query) the [ID_Lid] field contains the value of the
>> >> > first
>> >> > record of the query. It should contain the value of the selected
>> >> > record
>> >> > in
>> >> > that wquery. How do I set the value of the link field to the value
>> >> > [ID_Lid]
>> >> > of the selected record?
>> >> >
>> >> > Ron
>> >> >
>> >> > "Allen Browne" wrote:
>> >> >
>> >> > > The basic idea is to put the 2 parts together with AND between
>> >> > > them.
>> >> > > Brackets are optional, but can help.
>> >> > >
>> >> > > This example assumes both fields are of type Number (not Text),
>> >> > > and
>> >> > > you have
>> >> > > text boxes on the form that supply the values:
>> >> > > stLinkCriteria = "([ID_CSS] = " & [ID_CSS] & ") AND ([ID-Lid]
>> >> > > = "
>> >> > > &
>> >> > > [ID-Lid] & ")"
>> >> > >
>> >> > > If it doesn't work correctly, make this the next line:
>> >> > > Debug.Print stLinkCriteria
>> >> > > Then when it fails, open the Immediate Window (press Ctrl+G), and
>> >> > > see
>> >> > > what
>> >> > > came out. It has to look exactly like the WHERE clause of a query.
>> >> > > You can
>> >> > > mock up a query putting any values in the Criteria, and swith the
>> >> > > query to
>> >> > > SQL View (View menu in query design) to see the WHERE clause.
>> >> > >
>> >> > > If the fields are Text type, you need extra quote marks.
>> >> > >
>> >> > > "RoBo" <RoBo[ at ]discussions.microsoft.com> wrote in message
>> >> > > news:CEB76F35-1E54-4418-8403-73FEDB526202[ at ]microsoft.com...
>> >> > > >I am having a problem. From a selection from, I display a list of
>> >> > > >records
>> >> > > > that meet one link field. From the shown list I would like to
>> >> > > > select a
>> >> > > > record
>> >> > > > but this record can only be selected by using two link-criteria
>> >> > > > [ID_CSS]
>> >> > > > and
>> >> > > > [ID-Lid]. How do I specify this correctly in the stLinkCriteria
>> >> > > > field?
>> >> > > >
>> >> > > > Thanks for helping me out. in the Dutch forum nobody answered
>> >> > > > me.


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net