From: sam on
Hi All,

I am really strugling with refreshing a subform with updated results.

Basically, I have certain search criterias and a search button in the form
header, and a sub form in the form detail section. So once a user enters any
search criteria and hits search, the results should be displayed in the
subform below. BUT the subform doesnt display any results unless I reopen the
form. Is there a way to refresh this subform?

I have tried a million things to make it work, but it doesnt refresh the
subform with the new query results.

Thanks in advance
From: Dirk Goldgar on
"sam" <sam(a)discussions.microsoft.com> wrote in message
news:95D81620-F241-4F60-AC95-151873DE49D3(a)microsoft.com...
> Hi All,
>
> I am really strugling with refreshing a subform with updated results.
>
> Basically, I have certain search criterias and a search button in the form
> header, and a sub form in the form detail section. So once a user enters
> any
> search criteria and hits search, the results should be displayed in the
> subform below. BUT the subform doesnt display any results unless I reopen
> the
> form. Is there a way to refresh this subform?
>
> I have tried a million things to make it work, but it doesnt refresh the
> subform with the new query results.


Is the subform's recordsource a query that refers to the fields on the form
for criteria? If so, you probably have to requery the subform:

Me.sfYourSubformName.Requery

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: sam on
Hey Dirk,

How do I assign a record source to a subform?? I have assigned the
recordsource to the main form but how do i do it to subform?

Thanks in advance

"Dirk Goldgar" wrote:

> "sam" <sam(a)discussions.microsoft.com> wrote in message
> news:95D81620-F241-4F60-AC95-151873DE49D3(a)microsoft.com...
> > Hi All,
> >
> > I am really strugling with refreshing a subform with updated results.
> >
> > Basically, I have certain search criterias and a search button in the form
> > header, and a sub form in the form detail section. So once a user enters
> > any
> > search criteria and hits search, the results should be displayed in the
> > subform below. BUT the subform doesnt display any results unless I reopen
> > the
> > form. Is there a way to refresh this subform?
> >
> > I have tried a million things to make it work, but it doesnt refresh the
> > subform with the new query results.
>
>
> Is the subform's recordsource a query that refers to the fields on the form
> for criteria? If so, you probably have to requery the subform:
>
> Me.sfYourSubformName.Requery
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>
From: Dirk Goldgar on
"sam" <sam(a)discussions.microsoft.com> wrote in message
news:EBEAF427-B6A5-4139-B5DE-58CF96814421(a)microsoft.com...
> Hey Dirk,
>
> How do I assign a record source to a subform?? I have assigned the
> recordsource to the main form but how do i do it to subform?


I'm not sure I understand the question. Normally, when you built your
subform as a form object, you would have given it a recordsource (or the
form wizard would have done so). Are you asking about how to change this
recordsource manually? Or about how to change it dynamically, via VB code?

Bear in mind that there can be some confusion between the subform control on
the parent form, which displays a child form in a window, and the form
object itself that the control displays. The subform *control* doesn't have
a recordsource; that's a property of the "source object" form that the
subform control displays.

What is your actual setup? What are the names of the ...

1. Main form?

2. Subform control (on the main form)?

3. Subform source-object form?

What is in the RecordSource property of the source-object form?

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: sam on
Hi Dirk,

What is your actual setup?

I have search criterias in form header where users select search criterias
and click search, Now those search results are displayed as a query
result(newQuery). What I want is to display those query result in the
subform(which I am able to do) But for some reason the subform doesnt
refresh. SO once I close this form and reopen it then I see the subform with
the updated results.


What are the names of the ...

1. Main form?
Form1

2. Subform control (on the main form)?
What do you mean by Subform control? If you mean name of the subform then
its ChildForm1


3. Subform source-object form?

SourceObject of the subform is "Query.newQuery"

What is in the RecordSource property of the source-object form?
What do you mean by RecordSource property of the source-object form?
The name of the RecordSource is "newQuery"

Thanks in advance


"Dirk Goldgar" wrote:

> "sam" <sam(a)discussions.microsoft.com> wrote in message
> news:EBEAF427-B6A5-4139-B5DE-58CF96814421(a)microsoft.com...
> > Hey Dirk,
> >
> > How do I assign a record source to a subform?? I have assigned the
> > recordsource to the main form but how do i do it to subform?
>
>
> I'm not sure I understand the question. Normally, when you built your
> subform as a form object, you would have given it a recordsource (or the
> form wizard would have done so). Are you asking about how to change this
> recordsource manually? Or about how to change it dynamically, via VB code?
>
> Bear in mind that there can be some confusion between the subform control on
> the parent form, which displays a child form in a window, and the form
> object itself that the control displays. The subform *control* doesn't have
> a recordsource; that's a property of the "source object" form that the
> subform control displays.
>
> What is your actual setup? What are the names of the ...
>
> 1. Main form?
>
> 2. Subform control (on the main form)?
>
> 3. Subform source-object form?
>
> What is in the RecordSource property of the source-object form?
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>