Talk About Network

Google





Software > Access Forms > Re: Dynamic Que...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 7 Topic 44666 of 46786
Post > Topic >>

Re: Dynamic Query Based on Current Row

by =?Utf-8?B?Qm9uejA5OQ==?= <Bonz099@[EMAIL PROTECTED] > Aug 9, 2008 at 05:55 PM

Ok so let me see if I have this right, for the on click for the button I
use 
this:

dim strWhere       as string
strWhere = "DateSubmited = #" & format(me!DatesSubmitted,"mm/dd/yyyy") &
"#"
docmd.Openform "MyRe****t",acViewPreview,,,strwhere

So that particular code opens a form called "MyRe****t" and that form is 
linked to query. And my Query should looks like "SELCT * FROM Table WHERE 
DateSubmitted = strwhere" 

Is that right? Or do i not even need to create a query? Im sorry im really

new to writing applications in Access. I really appreciate the help
you’ve 
given me thus far. 


"Albert D. Kallal" wrote:

> "Bonz099" <Bonz099@[EMAIL PROTECTED]
> wrote in message
> news:44EF7C0F-0A9F-4236-A334-66DE3D3AA589@[EMAIL PROTECTED]
> > Idealy I would want to build a re****t that would allow me to pass the
> > "datesubmitted" to the query for it. But it have no idea where to
paste
> > this
> > code or how to structure the dynamic query.
> >
> > Would you mind explaining where to put the code and how my query that
the
> > form references should look like?
> 
> ok...
> 
> Lets assume you want to send the results to a re****t.
> 
> The user could then
> print, or close the re****t when done.
> 
> The 1st thing is to build a re****t based on that table. Set all of the
> sorting and grouping stuff in the re****t. Get it exactly the way you
want.
> 
> Note that the re****t will have no parameters and there is little
advantage 
> to
> base the re****t on a query. Once that re****ts looks the way you want,
then
> close it and save it.
> 
> Ok...now that our re****t is good, we go back to your continues form, and
the
> code behind the button will be:
> 
>  dim strWhere       as string
> strWhere = "DateSubmited = #" & format(me!DatesSubmitted,"mm/dd/yyyy") &
"#"
> docmd.Openform "MyRe****t",acViewPreview,,,strwhere
> 
> So, the code goes behind that button on the continues form you talked
> about...
> 
> I have assumed that the date on that row when clicked is
me!DatesSubmitted
> (I you have to change that to the name of the actual date field you used
> (can't read minds!!!).
> 
> If you allow editing of data in the continues form, then you need to
force a
> disk write BEFORE you launch the re****t. Change above to:
> 
>  dim strWhere       as string
> strWhere = "DateSubmited = #" & format(me!DatesSubmitted,"mm/dd/yyyy") &
"#"
> me.refresh
> docmd.Openform "MyRe****t",acViewPreview,,,strwhere
> 
> So, it is assumed that the above code goes behind the button your
pressing.
> We thus do not have to build a new query for the re****t..but only pass
it
> the "where" clause to restrict it to whatever we want -- in this case
the
> one date.....
> 
> -- 
> Albert D. Kallal    (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@[EMAIL PROTECTED]
> 
> 
> 
>
 




 7 Posts in Topic:
Dynamic Query Based on Current Row
=?Utf-8?B?Qm9uejA5OQ==?=   2008-08-07 21:11:01 
Re: Dynamic Query Based on Current Row
"Albert D. Kallal&qu  2008-08-07 22:48:26 
Re: Dynamic Query Based on Current Row
=?Utf-8?B?Qm9uejA5OQ==?=   2008-08-08 09:05:01 
Re: Dynamic Query Based on Current Row
"Albert D. Kallal&qu  2008-08-08 18:11:37 
Re: Dynamic Query Based on Current Row
=?Utf-8?B?Qm9uejA5OQ==?=   2008-08-09 17:55:01 
Re: Dynamic Query Based on Current Row
"Albert D. Kallal&qu  2008-08-11 01:32:38 
Re: Dynamic Query Based on Current Row
Piet Linden <PieterLin  2008-08-09 20:49:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 14:17:21 PST 2009.