Solved

ADO Field Record Count...

Posted on 2000-03-14
4
255 Views
Last Modified: 2008-03-17
Please can I have advised from the VB experts. Many Thanks!

I had a MS Access database with a 'updateRecord' field.

This 'updateRecord' field had a value of TRUE and FALSE.

How then can I do a count of knowing how many TRUE and FALSE records in the 'updateRecord' field.

Below is my coding...


Private Sub cmdUpdatPrice_Click()
   
    'Read Microsoft Access Updating File
   
    DiskFile = App.Path & "\sisTest3.mdb"
   
    On Error GoTo DatabaseAccessError:
   
    adosql.Refresh
    adoaccess.Refresh
   
    'adoaccess.Recordset.RecordCount
   
    Label1.Caption = adoaccess.Recordset.RecordCount
   
   
    Do While Not adoaccess.Recordset.EOF
       
        adosql.Recordset.MoveFirst
        adosql.Recordset.Find "ProductNo='" & adoaccess.Recordset.Fields("ProductNo") & "'"
       
        If Not adosql.Recordset.EOF Then
   
           adosql.Recordset.Fields("updateRecord") = True
       
           
           adoaccess.Recordset.Fields("updateRecord") = True
                       
   
           adoaccess.Recordset.Update
   
           adosql.Recordset.Update
           
   
           
           adoTableName.RecordSource = "[" & adosql.Recordset.Fields("TableName") & "]"
           adoTableName.Refresh
           adoTableName.Recordset.Find "ProductNo='" & adoaccess.Recordset.Fields("ProductNo") & "'"
           
           adoTableName.Recordset.Fields("DealerPrice1") = adoaccess.Recordset.Fields("DealerPrice1")
           adoTableName.Recordset.Fields("ListPrice1") = adoaccess.Recordset.Fields("ListPrice1")
           adoTableName.Recordset.Update
       
           Else

           adoaccess.Recordset.Fields("updateRecord") = False
           adoaccess.Recordset.Update

           
                     
        End If
     
     
        adoaccess.Recordset.MoveNext
       
    Loop

   
    MsgBox ("Sis Price Updating Done. Click OK to exit to Price Updating Interface.")
   

ProcExit:
    Call cmdQuit_Click
   
    Exit Sub
   
   
DatabaseAccessError:
    MsgBox ("Oops ! SiS Price Updating File cannot be found. Please make sure the 'SiS Price Updating Template' Microsoft Access Database is in the SiS server"), vbExclamation
   
    Resume ProcExit
     
End Sub
0
Comment
Question by:felicia
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
roverm earned 0 total points
ID: 2618768
2 ways:

1.Set a filter on your recordset and see how many records are left (.RecordCount property).

2.Using SQL: SELECT COUNT(updateRecord) FROM MyTable
GROUP BY updateRecord

How many points do you offer?......

D'Mzzl!
RoverM
0
 
LVL 12

Expert Comment

by:roverm
ID: 2620868
I'm crying: a good answer but no points!

:-((

D'Mzzl!
RoverM
0
 

Author Comment

by:felicia
ID: 2627169
sooo....sorrie...i don't know why the systems did not give points...

I attached points with it...

:)

felicia
0
 
LVL 12

Expert Comment

by:roverm
ID: 2627380
Are the points deducted from your 'Available Points' ? If so: contact EE!

Otherwise, if you still want to give the point to me then make a dummy question (like "TO ROVERM"), wait for my response and then accept my response as an answer. But you don't HAVE to !

D'Mzzl!
RoverM
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now