Results 1 to 4 of 4
  1. #1
    injanib is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    67

    Recordcount with filter on

    Hi,



    The current event of my form counts the record in the recordset, and then if there is only one record, it runs another code. I have the code as follows.

    if DCount("*", "tblMytable")=1 then
    .......

    I need a similar code to count the record while the filter is on. And if the record count of the current filter is 1 then it should run the same code.

    Can someone help please.

    Thanks in advance.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    I think it may be better to use the RecordsetClone.RecordCount to find out how many records ther are. This should work with the filter on as well but remember to move to the last record of the RecordsetClone before using the RecordsetClone.RecordCount.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    injanib is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    67
    Thanks for the cool tip. It shortened my lengthy procedures in many cases. Works great.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Glad to be of help.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Slow response over VPN or To Filter or not To Filter
    By rcrobman in forum Database Design
    Replies: 0
    Last Post: 04-30-2011, 02:37 PM
  2. How do I filter on this ?
    By _Chris_ in forum Access
    Replies: 7
    Last Post: 08-12-2010, 08:34 PM
  3. Filter on #Num!
    By marley in forum Access
    Replies: 5
    Last Post: 07-28-2010, 06:59 AM
  4. VBA Filter
    By ntallman in forum Programming
    Replies: 7
    Last Post: 04-06-2010, 10:53 AM
  5. Replies: 3
    Last Post: 10-20-2009, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums