Count number of records after filtering

Hello,


Probably a question that's easy to answer but I have been searching for 
hours now & it's driving me rather crazy: I have applied a filter to a form 
and now I want to know how many records I have got as a result, or better, I 
want to know if there are any records left - how do  I do that?

Tried so far:

If Form.Recordset.Count = 0 Then ...
If Iserror(Form.RecordSet.Count) Then ...
If EOF(Recordset) Then ...

but that all does not work.


Thanks,
Gerwin
0
Utf
1/29/2010 10:40:01 PM
access 16762 articles. 3 followers. Follow

2 Replies
2492 Views

Similar Articles

[PageSpeed] 56

Gerwin:

An easy way is to add a hidden text box, txtCount say, to the form, with a
ControlSource property:

=Count(*)

You can then examine the value of the text box in code in the form's module:

    If Me.txtCount = 0 Then

or elsewhere:

    If Forms("YourForm").txtCount = 0 Then

Ken Sheridan
Stafford, England

Gerwin Ramaker wrote:
>Hello,
>
>Probably a question that's easy to answer but I have been searching for 
>hours now & it's driving me rather crazy: I have applied a filter to a form 
>and now I want to know how many records I have got as a result, or better, I 
>want to know if there are any records left - how do  I do that?
>
>Tried so far:
>
>If Form.Recordset.Count = 0 Then ...
>If Iserror(Form.RecordSet.Count) Then ...
>If EOF(Recordset) Then ...
>
>but that all does not work.
>
>Thanks,
>Gerwin

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/201001/1

0
KenSheridan
1/29/2010 11:09:14 PM
Try:
    If Me.Recordset.RecordCount = 0 Then MsgBox "All gone"

Immediately after a filter the full count may not be available, but it 
should be at least 1 if there are any records.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Gerwin Ramaker" <GerwinRamaker@discussions.microsoft.com> wrote in message 
news:E348F703-886C-4B78-A713-65FB8E1947BB@microsoft.com...
> Hello,
>
>
> Probably a question that's easy to answer but I have been searching for
> hours now & it's driving me rather crazy: I have applied a filter to a 
> form
> and now I want to know how many records I have got as a result, or better, 
> I
> want to know if there are any records left - how do  I do that?
>
> Tried so far:
>
> If Form.Recordset.Count = 0 Then ...
> If Iserror(Form.RecordSet.Count) Then ...
> If EOF(Recordset) Then ...
>
> but that all does not work.
>
>
> Thanks,
> Gerwin 

0
Allen
1/30/2010 4:24:08 AM
Reply:

Similar Artilces:

how do i count text cells in excel based on variable criteria?
I need a formula that will recalculate when the variables are changed. For example, I will input the variables for date "1/26/2010" and BU "09" and I want a count of how many assets that meet those criterion. For Acctg Date: 1/26/2010 BU: 09 Asset Count:_____ BU Acctg Date 08 1/25/2010 06 1/26/2010 06 1/25/2010 09 1/25/2010 09 1/26/2010 09 1/26/2010 Assuming in your example the date is in B1, the BU is in B2 and your data is in A5 to B10, enter this formula =SUMPRODUCT((A5:A10=B2)*(B5:B10=B1)) "anmaka57" wrote: > I need a for...

Incorrect number of unread messages in Outlook Express
I've seen this problem listed in several places, but have yet to find a satisfactory answer. Here's my sitation: I have a computer that shows an incorrect number of unread messages in the Outlook Express Inbox whenever it downloads messages. Sometimes it's only 1 more than the number it downloaded, sometimes more. I'm not subscribed to any newsgroups, nor do I have any rules or mail filters enabled, including junk mail filters. We've had this problem through two different IMAP accounts, two different ISPs, two different email addresses, and on two different Windows use...

Counting of certain hrs in to minutes
Dear Sir / Madam, :CONFUSED: THERE ARE CERTAIN QUERIES FROM MY END WHICH I WOULD LIKE TO GET SOLVED. I WOULD LIKE TO KNOW AS FOR 876000 HOURS HOW MANY MINUTES IT WOULD END UP IN 8760 HRS I.E. IN 365 DAYS OR A YEAR AND 8760 HRS HOW MANY MINUTES IT WOULD END IN 24 HRS THAT IS A DAY. Please let me know as soon as possible. Awaiting for your reply. -- iyer_parvati ------------------------------------------------------------------------ iyer_parvati's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=29124 View this thread: http://www.excelforum.com/showthread.php?th...

Project Number Changer
Some of our clients would love to see an addition to the Professional Services Tools Library to modify project numbers in project accounting. One of our clients uses this to track organizational projects and whenever there is a department re-org, they would like to merely renumber or rename the existing projects to accomodate. Jen, I wholeheartedly agree!! Our company has 1,500+ ongoing projects for journals where the names of the journals can change over time. We would like to be able to change the Project ID and Contract ID so the acronyms used in the ID's are intuitively rala...

Multiple Numbers on ONE Label
I have several thousand labels I need to print. I would like to put up to 4 part numbers on each label (Avery 5164). These labels will placed on boxes that hold product. Some labels may only get 2 or 3 part numbers per label depending on size of the part. My part numbers are classified as S,M,L. Can this be done? Example... ABC123 - small ABC234 - large (max 2 numbers per label) ABC345 - small ABC456 - med (max 3 numbers per label) BCD123 - small BCD234 See: Print a Quantity of a Label at: http://allenbrowne.com/ser-39.html The article assumes you have a Q...

Need Help Filtering a Form with VBA
I have a form whose underlying data comes primarily from "Table1" (for this example). On the form is a drop-down box that displays a field named "Primary OBS" for each record. "Primary OBS" is stored in "Table1". It is an index into another table "Table2" which contains a field named "Team Code". "Team Code" can look like "JD130000" or "JG320000", etc. What I need to do is to filter the records in the form by the first two letters of the "Team Code". In other words, the user ca...

Copying autonumbered paragraphs and retaining original numbers
I need to copy numbered paragraphs from multiple documents. The paragraphs are inconsistent and may be numbered using text, MS Word multi-level list styles or listnum fields. I can search the documents, find the needed paragraphs and copy them to a new document, but when I do, the numbering resets according to the destination document's contents. How do I retain the source document's numbering in the destination document so the reader can determine where in the source document the paragraph came from? Can I convert all the numbering to text before pasting without affe...

string fields in smartlist to be able to searched by number
Current functionality in Greatplains 8 only allows the user to search on a string field however when the results are returned the data included irrelevant data and not that specified in the search. Example Item number search between 1000 and 2000 Results of search on item number 1000, 100086, 100098, 2000 the results should only return 1000 and 2000. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, fo...

row number
hi, i would like know how to return a row number or cell number thru macro. i read some other posts that had this issue, but i could not understan much. so i would be thankful if someone helped me with this. thanks, mac -- Message posted from http://www.ExcelForum.com Hi Mac Sure. Which row number did you have in mind ? For the active cell it's Activecell.Row and Activecell.Column. Best wishes Harald "icestationzbra >" <<icestationzbra.17yhgt@excelforum-nospam.com> skrev i melding news:icestationzbra.17yhgt@excelforum-nospam.com... > hi, > > i wou...

Performing two Advanced Filters in the same sheet
Dear experts, I have a range that I am using the Advanced Filter to hide amounts less than 0. On the same worksheet, further down, I have a different range that I want to use the Advanced Filter to hide amounts less than 5. Each of these ranges feeds a different chart. When I use the Advanced Filter on the second range, the first range shows all the data. Is there a way around this? Can I use Advanced Filter for each different range on the same worksheet and if so, how? Thanks in advance, Neal You can copy the filtered data to another location in one fell swoop, assume the tabl...

Auto calc YTD Numbers
Cells A1:L1 equal "Jan" thru "Dec". M1 equals "YTD". Cells A2:L2 equal numeric values. If you haven't guessed it already, I would like M2 to sum all the values A2:L2 for those months previous and including the current month (but not future months). What is the best way for going about this Here are 2 ways =SUM(OFFSET($A$2,,,,MATCH(TEXT(TODAY(),"mmm"),$A$1:$L$1,0))) or =SUM(OFFSET($A$2,,,,MONTH(TODAY()))) hopefully your computer's clock is accurate -- For everyone's benefit keep the discussion in the newsgroup. Regards, Peo Sjo...

using if + networkingdays end with #name and not number of days
Hi, I'm having prob. getting the result for above function/formula. Co-worker use same function and it works for him. Running same function and file he used on my computer end with #name. Office is ok. function/formula is ok. Had same prob. 2 years ago with previous computer, and support helped changing something with regional and language set-up under control panel (don't remember what exactly-done some changes but didn't work). I have matches my set-up with my co-worker - it is the same. Does someone knows how to solve this issue ? Tools>Add-ins, check Analysis Toolpa...

100% stacked column chart with negative numbers
How do you create a 100% stacked column chart with negative numbers? After I create the chart it only goes up to 80% How do you want it to show? The total length (including negative amount) of the column should equal 100%. (make sure you haven't limited the scale of your y-axis) What the graph is showing you is that the positive numbers do not account for 100% of your data. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Stuck" wrote: > How do you create a 100% stacked column chart with negative numbers? After I > create th...

me too, problem with import... only 15 records
me too, problem with import... only 15 records.... also in one of my customers crm i need a fast answer.... I dont see a question to answer...? JUAN MARKETING wrote: > me too, problem with import... only 15 records.... also in one of my > customers crm > > i need a fast answer.... Hehe yeah, what is the question!? what are you trying to import? Sorry, I don't know the reason, bu each time i try to import x number of accounts or contacts, MSCRM only import 15 records... Promise, everything is ok... columns, format csv from excel, size, records.... I say that, becau...

Subquery
Hi, I'm trying to code a subquery on a table but to no avail...it's a very simple table that has Date (short date, just recording the day) and NAV which is a number (double). All I'm wanting to do is have a query that displays the Date, the NAV and the NAV from the day before - only recording business dates. In other words, the subquery number I want is the NAV from the record preceeding the current one. I've got as far as the below, but that just gets the same NAV number as today's: SELECT tblNAV.Date, tblNAV.NAV, (SELECT LAST(x.NAV) FROM tblNAV as X LEFT JOIN tblNAV on...

Changing Text to Number Problem.
I have a problem when importing information into an Excel spreadsheet. We have a system at work that has a front end Web based application (asp) that accesses an SQL database. Not all of the software is written yet, so to sort/filter data I have to copy lists of information from the Web based application to an Excel spreadsheet. Much of the information that I import (copy and paste) into the spreadsheet are hyperlinks to other information in the SQL database. To get rid of the hyperlinks once I have the list copied to my spreadsheet, I (copy and paste special, values only) the information on...

Highlighting Filtered column
I have a basic filter on an excel sheet. I would like to highlight the column in which the filter was selected. Can anyone think of a simple way to do this without having to resort to Macros (there are security issues at work, hence Macros can be awkward)? My first line of thought is to somehow detect when the filter has been selected and on which column and then use conditional formatting to highlight the column. However, I can't find a way to easily detect the filter status. Presumably in VB code I can find the filter and the appropriate property but I would rather not use a Macro. Tha...

how can i filter from two rows?
Hi all, I've two rows with properties addresses and i need to filter them out in third row in a way that any property which is not shown in row one appears in row three.say for example: Row 1 Row2 1 Confier Court 1 Berbris court 10 East Ham 3 East Ham 1 ABC 1 ABC 3 East Ham Now since 10 east ham is not showing in Row 2. I want this shown in 3rd row. Can anyone please help me on this? Thanks in advance. Cheers Hi as a starting point: http://www.cpearson.com/excel/duplicat....

Stacking data to show same number but different colors
I am needing to show two sets of data on a stacked bar that will reflect the total of the denominator. Example. I have 13 cases out of which 1 has a complication. I want the total on the bar to only reflect 13 but the coloring of the bars show both data points (13 and 1). Can this be done? Your stack total must be 13, so your differently formatted stacks have to be 12 and 1. Alternatively you could plot 13 and 1 as clustered columns, and set the overlap to 100. - Jon ------- Jon Peltier Peltier Technical Services, Inc. http://peltiertech.com/ wiggy wrote: > I am needing to sh...

New a view for owned and shared records
I'd like to define an accounts view that shows all accounts I own and any that I'm shared on. I can't find the field with the shared information. Any suggestions? Hi, So basically you want to see all accounts to which you have access. Define criteria for filters, dont mention the owner and you will see all account to which you have read access. Just put one filter. Show me all Active Accounts. -- PLEASE do click on Yes or No button if this post was helpful or not for our feedback. uMar Khan Email for direct contact: imumar at gmail dot com "Ed Crawford" wrote:...

Rounding numbers in sales receipts.
Hi there, I'm trying to modify a sales receipt so it translate a discount in $ to a discount in %, but I get numbers like this (-3.33333333333%). I need it to looks like currency but without the $ sign like this (-3.33%). Does anyone knows how to do it? Thanks, Julien ------=_NextPart_0001_207C0F12 Content-Type: text/plain Content-Transfer-Encoding: 7bit Good morning Julien, Thank you for posting your discount question. I am not sure what you are trying to calculate; but I would recommend that you take a look at the available receipt variables: Transaction.DiscountPercent...

Numbering bugs when saving Word 2007 as Word 97-2003
Using both Word 2003 and Word 2007 on Windows XP OS Okay, I've been dealing with this problem for awhile now. but it causes a lot of extra work. Half our staff use Word 2003 (home workers) and the other half have upgraded to Word 2007. I use both Word 2003 (telecommuting) and Word 2007 (office) and I do the finalizing of these files here. We share large-document files among us, so we save the files as Word 97-2003 so everyone can access. This results in numbering getting completely out of whack after you save it and reopne. Also the heading formatting is lost sometimes (b...

How do you record a partial stock exchange
I am using MSMoney standard 2003 edition. Back in 2001 ATTstockholders were allowed to exchange a portion of their shares for ATT Wireless shares. How do you record this type of transaction? A spin off or merger converts all the shares. I only convert 100 out of 230 shares. Thanks for your help In microsoft.public.money, pfl22@mindspring.com wrote: >I am using MSMoney standard 2003 edition. Back in 2001 >ATTstockholders were allowed to exchange a portion of their shares for >ATT Wireless shares. How do you record this type of transaction? A >spin off or merger converts...

What's SPF record and is it necessary to have one?
Hi all, What's SPF record? Is it necessary to have one? How to create one? (exchange 2003 Sp2 environment) Thanks in advance On Wed, 13 Sep 2006 06:43:02 -0700, Peter <Peter@discussions.microsoft.com> wrote: >Hi all, > >What's SPF record? Is it necessary to have one? How to create one? >(exchange 2003 Sp2 environment) > > >Thanks in advance > http://www.openspf.org/ Everything you need to know, even a wizard! Not required, but recommended. http://www.exchangeinbox.com/articles/013/antispoofing.htm "Peter" <Peter@discussions....

Excel Template for recording Blood Pressure readings?
Does anyone know of a template/chart for recording blood pressure readings over say 4 weeks that can show graphically (with superimposition of sheets if necessary) the daily variances along with pulse rates and any significant details that may have a bering on the current readings. Put the data of interest (date, systolic pressure, diastolic pressure, pulse, whatever else of interest) in individual columns. Select any cell in the range of cells containing data. Click the Chart Wizard button; select a line chart -- or some other chart if it has greater appeal for you. -- Regards, Tu...