From: Richard on
I have a form with (2) textboxes StartDate & EndDate also a command button.
When the command button is pressed a query captures the (2) dates and then
displays the correct results. I would like to see the results in a listbox
instead of a query window. The code behind the button is wizard created:

DoCmd.OpenQuery "Qcalendar", acViewNormal

Thanks
From: XPS35 on
=?Utf-8?B?UmljaGFyZA==?= wrote:

>
> I have a form with (2) textboxes StartDate & EndDate also a command button.
> When the command button is pressed a query captures the (2) dates and then
> displays the correct results. I would like to see the results in a listbox
> instead of a query window. The code behind the button is wizard created:
>
> DoCmd.OpenQuery "Qcalendar", acViewNormal
>
> Thanks

Let the query be the RowSource of your listbox and change the code
behind the button to:
Me.YourListbox.Requery

--
Groeten,

Peter
http://access.xps350.com

From: Steve on
Why do you want to see the resukts in a listbox? Do you want to select an
item i the listbox and do something else?

Steve
santus(a)penn.com


"Richard" <Richard(a)discussions.microsoft.com> wrote in message
news:54F193A2-5A74-4818-A24C-391DBBE4D630(a)microsoft.com...
>I have a form with (2) textboxes StartDate & EndDate also a command button.
> When the command button is pressed a query captures the (2) dates and then
> displays the correct results. I would like to see the results in a listbox
> instead of a query window. The code behind the button is wizard created:
>
> DoCmd.OpenQuery "Qcalendar", acViewNormal
>
> Thanks


From: John W. Vinson on
On Tue, 1 Jun 2010 20:48:01 -0700, Richard <Richard(a)discussions.microsoft.com>
wrote:

>I have a form with (2) textboxes StartDate & EndDate also a command button.
>When the command button is pressed a query captures the (2) dates and then
>displays the correct results. I would like to see the results in a listbox
>instead of a query window. The code behind the button is wizard created:
>
>DoCmd.OpenQuery "Qcalendar", acViewNormal
>
>Thanks

In that case, don't open the query at all; instead, set the Listbox's
Rowsource property to the name of the query:

Me!listboxname.RowSource = "QCalendar"

You might need to then requery the listbox.

--

John W. Vinson [MVP]