Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 2nd, 2005, 07:10 PM
Registered User
 
Join Date: Feb 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Refreshing the records displayed in a form

Hi,

I have a tabular form which displays the results of a saved query. Included on the form are controls to refine the displayed records by modifying the .SQL property of the underlying query. My problem is that I can not work out how to make the form display the new results - the the query changes, but the results displayed on the form do not. What method will achieve this without having to close and reopen the form?

Thanks,

Drew
 
Old March 3rd, 2005, 08:38 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

After your code to modify the SQL statement, use a line like this for the form:

'==========
Me.Requery
'==========

  You could put this on the SQL modifier control's After Update event. You may have to use the absolute statement like this:

'=====
Forms!frmYourFormName.Requery
'=====

HTH



mmcdonal
 
Old March 3rd, 2005, 07:51 PM
Registered User
 
Join Date: Feb 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the input. I have tried using the requery command, but to no avail. The only way I have been able to do it is this:

Me.RecordSource = "qryLog"
'then code to build SQL string
CurrentDb.QueryDefs("qryLog").SQL = strSQL
Me.RecordSource = "qryLog"

I can't explain why, but it works!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum Records Displayed tdaustin Classic ASP Basics 3 June 5th, 2005 07:32 PM
Refreshing a sub-form from another sub-from lguzman Access VBA 1 November 29th, 2004 05:07 PM
Displacement downwards of dabase records displayed LenB Classic ASP Databases 3 January 14th, 2004 12:28 PM
How can i avoid a form from being displayed ? MisbahAnsari VB.NET 1 September 17th, 2003 12:48 PM
Form not refreshing after form validation Mimi Javascript How-To 0 August 25th, 2003 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.