473,756 Members | 8,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to count number of rows in a subform?

15 New Member
I have created a form where one text box and two command buttons named Search and Clear are present. Under all these fields I am also including a subform which displays all the values stored in Patient table.

When I enter any word in the name text box and click enter then the values in sub form only display the details of the patient whose first name or last name matches with the given name. When button Clear is hit ( in future I am planning to make it cancel button , so that to cancel the operation ) textbox becomes empty.

I want to count the number of rows that result from the above operation.
I mean all the rows which are displayed in the subform.

If the particular patient exists in that Subform I want to implement a functionality where, when I click on the particular patient's row in sub from it should open Form which contains the details of that particular patient.

It would be great if someone can help me regarding this .....

Thanks,
Pdesh3
May 11 '07 #1
1 11451
JConsulting
603 Recognized Expert Contributor
I have created a form where one text box and two command buttons named Search and Clear are present. Under all these fields I am also including a subform which displays all the values stored in Patient table.

When I enter any word in the name text box and click enter then the values in sub form only display the details of the patient whose first name or last name matches with the given name. When button Clear is hit ( in future I am planning to make it cancel button , so that to cancel the operation ) textbox becomes empty.

I want to count the number of rows that result from the above operation.
I mean all the rows which are displayed in the subform.

If the particular patient exists in that Subform I want to implement a functionality where, when I click on the particular patient's row in sub from it should open Form which contains the details of that particular patient.

It would be great if someone can help me regarding this .....

Thanks,
Pdesh3
first part

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Dim rs As Object
  3. Set rs = Me.subfrm1.Form.RecordsetClone  'where subfrm1 is your subform
  4. Me.MyCount = rs.RecordCount   ' where MyCount is your textbox
  5. End Sub
  6.  
second part

Expand|Select|Wrap|Line Numbers
  1.     Dim stDocName As String
  2.     Dim stLinkCriteria As String
  3.     stDocName = "MyFormName"
  4.     stLinkCriteria = "ID=" & Me.myID
  5.     stDocName = "FormOneClone"
  6.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  7.  
J
May 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
44110
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr scott/tiger@common control=/full_path/test.ctl log=/full_path/adhoc/test.log SQL*Loader: Release 9.2.0.1.0 - Production on Tue Sep 2 10:49:27 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
2
6547
by: John Furphy | last post by:
Could someone assist with getting the count function working correctly in this example please. I know the count function will return all rows that do not have null values, but in this case I want to count all the rows except those with a zero sale price, (which are unsold). The table shows works offered for sale by an artist, with a positive figure under SalePrice indicating a sale, and I want to count the number sold by each auction...
1
2562
by: c.le_roq | last post by:
Hello, Using rollup I want to count the number of rows of a table called Table1 which is LEFT JOINED with a table called Table2. The problem is that we can have more than 1 rows in Table2 that matched 1 row in Table1. As a consequence the count of rows in table1 is bigger than the real number of rows contained in table1. For example:
2
2059
by: RitaG | last post by:
Hi. I need the count of the number of rows within a text file. I checked the File object but could not find a method there to do what I need. Is there an efficient way to count the numbers of rows? Currently all I can think of is opening the file for reading and counting every row. This could be a long tedious task as some of the text files have millions of rows in them.
22
3212
by: Joseph Shraibman | last post by:
On a 7.3.4 database: explain analyse select count(*) from elog; Aggregate (cost=223764.05..223764.05 rows=1 width=0) (actual time=81372.11..81372.11 rows=1 loops=1) -> Seq Scan on elog (cost=0.00..203012.24 rows=8300724 width=0) (actual time=3.91..71542.53 rows=8313762 loops=1) Total runtime: 81378.42 msec
0
8410
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record number changes fine. Within this main form I have a subform detailing distribution records for the contact (main form is based on this) that also has navigation buttons and a label showing Distribution 1 of ##. This is where the problem lies. The...
2
11121
by: patang | last post by:
I found the following to count the total number of VISIBLE rows of datagrid datagrid.visiblerowcount How do we count the total number of ACTUAL (not just visible) rows of datagrid? Thanks in advance.
68
6826
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
9
3653
blyxx86
by: blyxx86 | last post by:
Hey guys, I know it's possible, but I do not know how to do this... I am looking for a way to count the total number of rows returned in a subform or a query. Similar to the way an Excel spreadsheet has the row numbers, but always starting from 1. I just hate having to physically count the items when someone wants to know how many things were finished or shipped or whatever else. So, It looks sorta like: ID Date Cust 005 11/4 ...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.