PC Review


Reply
Thread Tools Rate Thread

link a subform instead of separate form ..... stLinkCriteria

 
 
=?Utf-8?B?TGlzYQ==?=
Guest
Posts: n/a
 
      7th Feb 2006
Hi,

I have 4 unbound combo boxes that limit the records I want to display, I
have them working for a new form, but would like to display the info in a
subform when a button called See_Schedule is clicked. Right now I have a
series of if statements that builds the appropriate stLinkCriteria before the
line:
DoCmd.OpenForm stDocName, , , stLinkCriteria

How can I use the same logic to link to a subform??

Lisa
 
Reply With Quote
 
 
 
 
Marshall Barton
Guest
Posts: n/a
 
      7th Feb 2006
Lisa wrote:
>I have 4 unbound combo boxes that limit the records I want to display, I
>have them working for a new form, but would like to display the info in a
>subform when a button called See_Schedule is clicked. Right now I have a
>series of if statements that builds the appropriate stLinkCriteria before the
>line:
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
>How can I use the same logic to link to a subform??



In some simple situations, you can assigne the criteria
string to the subform's Filter property:

Me.subformcontrol.Form.Filter = stLinkCriteria
Me.subformcontrol.Form.FilterOn = True

But there may be issues doing that, so I prefer to set the
subform RecordSource property:

strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
Me.subformcontrol.Form.RecordSource = strSQL

--
Marsh
MVP [MS Access]
 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGlzYQ==?=
Guest
Posts: n/a
 
      7th Feb 2006
If I want to use the
strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
Me.subformcontrol.Form.RecordSource = strSQL

way, where do I put this code - onClick for the button??

Lisa

"Marshall Barton" wrote:

> Lisa wrote:
> >I have 4 unbound combo boxes that limit the records I want to display, I
> >have them working for a new form, but would like to display the info in a
> >subform when a button called See_Schedule is clicked. Right now I have a
> >series of if statements that builds the appropriate stLinkCriteria before the
> >line:
> > DoCmd.OpenForm stDocName, , , stLinkCriteria
> >
> >How can I use the same logic to link to a subform??

>
>
> In some simple situations, you can assigne the criteria
> string to the subform's Filter property:
>
> Me.subformcontrol.Form.Filter = stLinkCriteria
> Me.subformcontrol.Form.FilterOn = True
>
> But there may be issues doing that, so I prefer to set the
> subform RecordSource property:
>
> strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
> Me.subformcontrol.Form.RecordSource = strSQL
>
> --
> Marsh
> MVP [MS Access]
>

 
Reply With Quote
 
Marshall Barton
Guest
Posts: n/a
 
      7th Feb 2006
I assume the button's click event. Use this code instead of
the OpenForm, where ever that was.
--
Marsh
MVP [MS Access]


Lisa wrote:
>If I want to use the
> strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
> Me.subformcontrol.Form.RecordSource = strSQL
>
>way, where do I put this code - onClick for the button??
>
>
>> Lisa wrote:
>> >I have 4 unbound combo boxes that limit the records I want to display, I
>> >have them working for a new form, but would like to display the info in a
>> >subform when a button called See_Schedule is clicked. Right now I have a
>> >series of if statements that builds the appropriate stLinkCriteria before the
>> >line:
>> > DoCmd.OpenForm stDocName, , , stLinkCriteria
>> >
>> >How can I use the same logic to link to a subform??

>>
>>

>"Marshall Barton" wrote:
>> In some simple situations, you can assigne the criteria
>> string to the subform's Filter property:
>>
>> Me.subformcontrol.Form.Filter = stLinkCriteria
>> Me.subformcontrol.Form.FilterOn = True
>>
>> But there may be issues doing that, so I prefer to set the
>> subform RecordSource property:
>>
>> strSQL = "SELECT . . . FROM table WHERE "& stLinkCriteria
>> Me.subformcontrol.Form.RecordSource = strSQL

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link Subform to subform within another subform Sarah Microsoft Access Form Coding 2 1st Mar 2008 02:38 AM
Use values from form & subform in stlinkcriteria =?Utf-8?B?cndpbGxpYW1z?= Microsoft Access Forms 3 21st Mar 2007 11:14 PM
"docmd.OpenForm stDocName, , , stLinkCriteria" =?Utf-8?B?R3JheQ==?= Microsoft Access 1 5th Sep 2004 10:23 PM
"stLinkCriteria" from a Sub Form button to open another Form =?Utf-8?B?U3RldmUgRg==?= Microsoft Access Form Coding 1 7th Nov 2003 07:03 PM
How to link a separate form to records associated with a subform? Jim Moore Microsoft Access Form Coding 2 14th Oct 2003 11:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:09 PM.