Solved

ADO Field Record Count...

Posted on 2000-03-14
4
252 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

22 Experts available now in Live!

Get 1:1 Help Now