Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 September 29th, 2004, 04:02 PM
Authorized User
 
Join Date: Jun 2003
Location: Irvine, CA, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default When to Refresh a SubForm

Hi.

I have a form with a subform. When a certain control changes value on the form, a different filter is applied to the subform. The subform's default view is DataSheet and rows from a table are displayed in it. This works well except on the subform at the bottom where it says "Record 1 of 4 (Filtered)" (when I have 4 rows).

When 3 rows are displayed in the subform, it will display the count of rows from the previous recordset until I hit the right arrow to get the next row and then I'll see "Record 1 of 3 (Filtered)".

I tried several places on several events to Refresh the subform to overcome this but have not been able to resolve this.

Any suggestions will be greatly appreciated.

Thanks.

Rita
 
Old September 30th, 2004, 03:44 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

You could put this on the main form's AfterUpdate event:

Me.YourSubformNameHere.SourceObject = "SELECT..." and change the sourceobject of the form when data on main form changes. Or you can change its filter

Me.YourSubformNameHere.Filter = "..."


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old September 30th, 2004, 03:57 PM
Authorized User
 
Join Date: Jun 2003
Location: Irvine, CA, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Greg.

Thanks for the suggestion. I already have code in place to do that:
  Private Sub txtSCRID_LostFocus()
    Me.[SCR_Links_Subform].Form.FilterOn = True
    If Not IsNull(Me.txtSCRID) Then
        Me.[SCR_Links_Subform].Form.Filter = "LinkedSCRorDefect <> "
        & Me.txtSCRID
    End If
  End Sub

I get the correct rows coming up on the subform. What's incorrect is the count of rows returned that shows up at the bottom of the grid on the subform. Once I hit the right arrow it then displays correctly.

Rita
 
Old October 1st, 2004, 07:25 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

How about for the heck of it if you threw in this line before the END IF?

Me.[SCR_Links_Subform].Requery



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old October 1st, 2004, 09:20 AM
Authorized User
 
Join Date: Jun 2003
Location: Irvine, CA, USA.
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Greg.

Good suggestion!
However, I'm still getting the same results.

Thanks.
Rita




Similar Threads
Thread Thread Starter Forum Replies Last Post
subform jeremy1048 Access 0 May 2nd, 2008 09:03 AM
Refresh GridView Using Refresh Button msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 05:57 AM
Refresh Parent Subform echovue Access 1 October 18th, 2005 09:59 PM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM





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