473,396 Members | 1,815 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,396 software developers and data experts.

Record Count

Hi i need help guys, can some body tell how to count records and display it in a label,,, i have a program that has a database in access, a simple databse program, i use adodc,,, the program stores name, address, phone number, and student number, its already running, but the thing is i wanted to be able to display how many records do i have in my program,

hope there's someone who can help or give an idea on how to solve my problem. thank you in advance.
Mar 9 '07 #1
5 1630
willakawill
1,646 1GB
Hi. Can you post the code you have already at the point you want to count the records please?
Mar 9 '07 #2
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command2_Click()
  2.  
  3.  
  4. If Adodc1.Recordset.EOF = True Then
  5.     MsgBox ("No more Records")
  6. Text1.Locked = True
  7. Text2.Locked = True
  8. Text3.Locked = True
  9. Text4.Locked = True
  10.  
  11. End If
  12. End Sub
  13.  
  14. Private Sub Command3_Click()
  15. Adodc1.Recordset.MovePrevious
  16.  
  17. If Adodc1.Recordset.BOF = True Then
  18.     MsgBox ("No more Previous Records")
  19. End If
  20.  
  21. End Sub

So far that the code am still workin for ADDING & DELETING records, for the mean time am adding records through access but not in the program it self, thats one thing i need to know on how i can add & delete records without going to microsoft access...
Mar 9 '07 #3
willakawill
1,646 1GB
This should get you the number of records:
Expand|Select|Wrap|Line Numbers
  1. Adodc1.Recordset.MoveLast
  2. txtRecordCount.Text = Adodc1.Recordset.RecordCount
Adding and Deleting will be in your help for adodc
You should give your command buttons useful names so that you can distinguish between them in code e.g.
cmdAddNew
or
cmdMoveNext
Mar 9 '07 #4
vijaydiwakar
579 512MB
Hi i need help guys, can some body tell how to count records and display it in a label,,, i have a program that has a database in access, a simple databse program, i use adodc,,, the program stores name, address, phone number, and student number, its already running, but the thing is i wanted to be able to display how many records do i have in my program,

hope there's someone who can help or give an idea on how to solve my problem. thank you in advance.
see this can be done in 2 ways use qry like select count(1) from tblname
count(1) is available in ora
and other way is to use recordcount as willakawill sugets
Mar 10 '07 #5
hello ive just figured out how to make my program work as i want too.
for contributions here my code::

Private Sub Command1_Click()

adoConnect.Recordset.AddNew
Text1.SetFocus


End Sub

Private Sub Command2_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox ("No record/s deleted"), vbCritical
Text1.Text = "<Blank>"
Text2.Text = "<Blank>"

Else
adoConnect.Recordset.Delete
adoConnect.Refresh
adoConnect.Recordset.MoveNext
adoConnect.Refresh
MsgBox ("Record Deleted!")
End If

End Sub

Private Sub Command3_Click()
Dim ans As String


If Text1.Text = "" And Text2.Text = "" Then
ans = MsgBox("No more previous records!!! " & _
"Do you want to procedd?", vbYesNo)
adoConnect.Recordset.MoveFirst

Else
adoConnect.Recordset.MovePrevious
End If


End Sub

Private Sub Command4_Click()
Dim ans As String


adoConnect.Recordset.MoveNext

If adoConnect.Recordset.EOF = True Then
ans = MsgBox("No more Records!!! " & _
"Do you want to procedd?", vbYesNo)

If ans = vbNo Then
End
Else

adoConnect.Recordset.MoveFirst


End If
End If






End Sub

Private Sub Command5_Click()

Label1.Caption = adoConnect.Recordset.RecordCount & " " & "Record/s"


End Sub

Private Sub Command6_Click()
If Text1.Text = "" And Text2.Text = "" Then
MsgBox ("Cannot save blank entries!"), vbCritical
Else
MsgBox ("Record was save")
adoConnect.Recordset.Update

End If

If Text1.Text = "<Blank>" And Text2.Text = "<Blank>" Then
MsgBox ("Record was save!"), vbCritical
adoConnect.Recordset.Update
End If

End Sub



thanks for all the help!!!! i really appreciate it... Thank you VB Masters.
Mar 10 '07 #6

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

Similar topics

6
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...
3
by: thomasp | last post by:
I am trying to get a record count of a PHP query on a MS Acess database using ODBC with a DSN for MS ACCESS connection. I got this code from the PHP manual user notes. It seems to return the...
1
by: Justin Koivisto | last post by:
I am trying to create a report that displays a name of an advertising source and count of the number of times it was hit between certain date ranges. The data is split between two different...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
1
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the...
1
by: darrel | last post by:
I'm trying to whip up a fancy repeater control that will put records into a two-column table for me. This is how I envision it working: itemtemplate if record count = odd then write out the...
7
by: Mike | last post by:
I have a form where I have turned off the default navigation buttons. I then created my own. This works fine. The only questions that I have is on the default navigation buttons it shows total...
4
by: Peter W Johnson | last post by:
Hi guys, I have a problem with a datagrid record count. Here is the code:- <snip> Public Class frmMerchantDeposit Inherits System.Windows.Forms.Form Dim myconnection As New...
2
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a...
4
by: Phil Stanton | last post by:
Sorry to repost, but am having another look at deleting a record. I have a form (Member) and have removed all the event procedures associated with the Form (OnCurrent, OnDelete, OnActivate etc)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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,...

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.