473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Counting records in open subform. Code updating nonstop

547 512MB
When i use this code to count the number of records on display in a specific subform in the "txtRecordNo" field that is open now, it seems to "update" all the time as the cursor changes every second and i am unable to add new records on mainform, untill i click in one of the fields of this Subform. Then it settles down. Otherwise it works 100% when i add records in the subform.
pls help

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  
  3.     Dim rst As DAO.Recordset
  4.     Dim lngCount As Long
  5.  
  6.     Set rst = Me.RecordsetClone
  7.  
  8.     With rst
  9.         .MoveFirst
  10.         .MoveLast
  11.         lngCount = .RecordCount
  12.     End With
  13.  
  14. 'Show the result of the record count in the text box (txtRecordNo)
  15.  
  16.     Me.txtRecordNo = lngCount
  17. End Sub
Nov 24 '10 #1

✓ answered by TheSmileyCoder

You should remember to include a
Set rst=nothing
at the end of your code. However this has nothing to do with the issue at hand.
Do you have other code running in main form or subform?
Which version of access are you using?

1 1586
TheSmileyCoder
2,322 Expert Mod 2GB
You should remember to include a
Set rst=nothing
at the end of your code. However this has nothing to do with the issue at hand.
Do you have other code running in main form or subform?
Which version of access are you using?
Nov 24 '10 #2

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

Similar topics

2
by: shadab | last post by:
I wants Open Source Code of a Web site made in PHP for Updation of my Website.
3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
2
by: allyn44 | last post by:
Hello, I have built a serch form for users to edit records. I only want them to pull up the record they need, and I want to check for nulls. There should not be dupes becasue the underlying...
4
by: tlyczko | last post by:
I have been looking on the NGs and I found this code to show if a subform has no records. I have this code in the MAIN form OnClose event: Private Sub btnClose_Click() '4/16/06 new code that...
3
by: Ryan Liu | last post by:
Hi, I want to change keywords text color in a text editor. I select RichTextBox and use its Select() method to select keywords line by line, one by one, then change its color. ...
0
by: medha1 | last post by:
Are you a programmer? Have you ever had to search for open source code? We are surveying programmers on how they search for open source software on the web, as part of our project at the...
5
by: trgpham | last post by:
Hi All, I have an existing access application which I need to open to modify the code. I press Shift + double click on the file (.mdb) but it start running the application, but not the code. ...
11
by: CrostonScottish | last post by:
I've got myself a bit mixed up with all my sqls and subforms. I am a bit new to relationship databases. I have a database designed for booking students on to courses run at our hospice. It is...
3
by: informankur | last post by:
Hi All, I am trying to create a form for updating values. I have a Table - ASP with Date, Product, Q1,Q2,Q3,Q4 fields. I have a Form ASP_Main with "Date" field for filtering by the date selected....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.