[AccessD] When a query refers to a control on a form whichisnot open - how to supply a default?

Stuart McLachlan stuart at lexacorp.com.pg
Wed Jun 2 16:35:34 CDT 2010


My feeling exactly - using parent/child binding to do all the hard work automagically.

Assuming that the parent form is bound, you can also use a Where condition in the 
Docmcmd.OpenForm to filter it .

-- 
Stuart

On 2 Jun 2010 at 12:10, David McAfee wrote:

> So frmExciterIndividualEntry is the dictator form, not the parent or
> the subform, correct?
> 
> Couldn't RecordID be passed to the parent form via OpenArgs?
> 
> Change the subform's recordsource to
> SELECT TblCIB.RecordID, TblCIB.ShopOrder, TblCIB.ItemNumber FROM TblCIB
> then set the parent child link between the two forms to RecordID, that
> way Access handles it.
> 
> 
> On Wed, Jun 2, 2010 at 11:37 AM, Bill Benson (vbacreations)
> <vbacreations at gmail.com> wrote:
> > Hi Dave, welcome to the party. The query is the recordsource of a subform
> > existing on a form which contains a partial view of information the user has
> > already entered on a dictator form. They enter their information on the
> > latter's interface, click a button to launch the new form (which has several
> > subforms); when they get to the newly opened form, the subform in question
> > is supposed to have as its recordsource the query in question, whose results
> > are limited by the first form. Seems pretty standard to me?
> >
> >
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee
> > Sent: Wednesday, June 02, 2010 2:09 PM
> > To: Access Developers discussion and problem solving
> > Subject: Re: [AccessD] When a query refers to a control on a form whichisnot
> > open - how to supply a default?
> >
> > Let me think out of the box for a bit.
> >
> > Where is this query being called from?
> >
> > Usually when I call a query that refers to a form, it is called from
> > the form being referred to.
> >
> > If this is the case, you can check if the if the field is blank before
> > you call the query.
> >
> > something like
> >
> > if nz(me.RecordID,0) = 0 then
> >     'Call query or report without the reference to this form
> > Else
> >     'call existing query which references this form
> > end if
> >
> >
> >
> > On Wed, Jun 2, 2010 at 10:47 AM, Bill Benson (vbacreations)
> > <vbacreations at gmail.com> wrote:
> >> Doug, not sure how to implement this? The query is "out there" as an
> > object
> >> in the database; it is used as a recordsource for a subform ... how am I
> >> supposed to let code control it? I am not using any code?
> >>
> >> On the other hand if what you mean is that I should set a parameter equal
> > to
> >> a function which code I have controlled - well that is the same thing as
> >> others are suggesting.
> >>
> >> My choice appears to be VBA or VBA or VBA ... rather than VBA or more
> >> flexible SQL...?
> >>
> >> -----Original Message-----
> >> From: accessd-bounces at databaseadvisors.com
> >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Doug Steele
> >> Sent: Wednesday, June 02, 2010 10:11 AM
> >> To: Access Developers discussion and problem solving
> >> Subject: Re: [AccessD] When a query refers to a control on a form which
> >> isnot open - how to supply a default?
> >>
> >> Change the query to a parameter query; then your code controls the value
> >> that is passed to the query.
> >>
> >> Doug
> >>
> >> On Tue, Jun 1, 2010 at 3:43 PM, Bill Benson (vbacreations) <
> >> vbacreations at gmail.com> wrote:
> >>
> >>> SELECT TblCIB.RecordID, TblCIB.ShopOrder, TblCIB.ItemNumber FROM TblCIB
> >>> WHERE
> > (((TblCIB.RecordID)=[Forms]![frmExciterIndividualEntry]![RecordID]))
> >>>
> >>> The above sql is causing the user to be prompted for a value of
> >>> [Forms]![frmExciterIndividualEntry]![RecordID] when that form is not open
> >>> and/or the control not populated. I would like that when there is no form
> >>> or
> >>> control available at runtime, the query just assumes a 0 or "" [default]
> >> so
> >>> that my users are not prompted. Is there some simple [single expression]
> >>> way
> >>> to do this short of the workaround I show below, which seems like
> >>> overkill??
> >>>
> >>>
> >> --
> >> AccessD mailing list
> >> AccessD at databaseadvisors.com
> >> http://databaseadvisors.com/mailman/listinfo/accessd
> >> Website: http://www.databaseadvisors.com
> >> No virus found in this incoming message.
> >> Checked by AVG - www.avg.com
> >> Version: 9.0.819 / Virus Database: 271.1.1/2912 - Release Date: 06/02/10
> >> 02:25:00
> >>
> >>
> >> --
> >> AccessD mailing list
> >> AccessD at databaseadvisors.com
> >> http://databaseadvisors.com/mailman/listinfo/accessd
> >> Website: http://www.databaseadvisors.com
> >>
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > No virus found in this incoming message.
> > Checked by AVG - www.avg.com
> > Version: 9.0.819 / Virus Database: 271.1.1/2912 - Release Date: 06/02/10
> > 02:25:00
> >
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 






More information about the AccessD mailing list