Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    Hong Kong
    Posts
    29

    Unanswered: Two problems about ACCESS Macro programming

    Hi!

    Two problems about ACCESS Macro programming

    1) I retrieve records by a SQL statement into a RecordSet, I would like to know the total number of records in the RecordSet, is there a field/value in the RecordSet storing this, I don't want to use a counter to count it and get it after fetching all records.

    2) There are three fields in a form A, B and C. After updating C field, I would like to update field A and B on conditions that A and B are empty. My program is like this,

    If [A] = "" and [B] = "" Then
    XXX
    XXX
    End If

    This is included in C_AfterUpdate function

    However, the above statements did not work.

    Can someone help? Thanx in advance

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    If you are pulling all the records to a form, you can put a text box on the form and set the Control Source to =count(*).
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    In regards to your 2nd question,

    In the AfterUpdate event of C put in this code:
    If isnull([A]) and isnull([B]) then
    ......do whatever.....
    end if

    What you have should do basically the same thing. I just replaced the "" with isnull.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •