By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,883 Members | 2,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,883 IT Pros & Developers. It's quick & easy.

Subform refresh to changed query

P: n/a
How do I make a subform change to reflect a changed query which is the
forms Source Object.

Another part of the application has changed the query via VB, and I can
see that the query is how I want it, but the subform hasn't picked up on
the changes.

Refresh doen't work
RefreshDatabaseWindow doesn't work

Anything along these lines?

Thanks for your help

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Once you detect the query change, trigger a sub with the following
code:
Me.RecordSource = "Query_Name"

This will refresh the form.

Nov 13 '05 #2

P: n/a
access-guru? wrote:
Once you detect the query change, trigger a sub with the following
code:
Me.RecordSource = "Query_Name"

This will refresh the form.

Thanks for your reply,

The subform doesn't have focus -- would that matter?

Would I need something along the lines of

Forms!MainForm!Subform.RecordSource = "QueryName"

Thanks again
Nov 13 '05 #3

P: n/a
access-guru? wrote:
Once you detect the query change, trigger a sub with the following
code:
Me.RecordSource = "Query_Name"

This will refresh the form

Thanks, but I get an error message
runtime error '438
object doesn't support this property or method
I have a master form called 'Hall Bookings from Calendar'
inside this I have a subform called 'Sidebar'

Perhaps a picture is better...

__________________________________________________ _____________________________
Form_Hall Bookings from Calendar
__________________________________________________ _____________________________
______________________
Subform_Sidebar | Date:
| Name:
P Dec 31 New years | No Guests:
R Jan 5 Wedding | Many other fields:
R Jan 7 Meeting |
______________________|
______________________
Listbox |
|
Riverside |
Palace |
|
_______________________
__________________________________________________ _______________________________
So when they click on Riverside in the listbox, the Query that is the
recordsource for sidebar is changed to restrict the listing to only R
events.

Clicking on an individual event in the sidebar causes the fields on the
form to reflect that event.

Everything is working, except the update to the sidebar. If I close the
form and reopen it, it reflects the changed query.
Thanks for any help you can give

Lester.
Nov 13 '05 #4

P: n/a
I found a partial solution/workaround

I placed the me.recordsource="xxx" that you suggested in the doubleclick
event of all fields on the form

Now everything is usable, but it's not the most elegant fix.

If I put it in the click event, the window always scrolls up to the top
and focus moves to the first record everytime someone clicks inside this
subform. Same problem with filtering techniques.

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.