• Loop thru records to check for error (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Loop thru records to check for error (Access 2000)

    Author
    Topic
    #402004

    I created an application that has been in successful use for several years. Until recently, records were keyed directly into the application and a particular field (the Vehicle Identification Number, or VIN) was checked for errors through an AfterUpdate event (via code). This error check is very involved and mandated by the federal code. We have since changed the overall dealership software which affords us the opportunity to import data directly from it to this application. I am NOT a trained programmer, but have had much success and experience with Access. What I’ve never had to learn is how to loop thru records and perform operations. Unfortunately my attempts this far have been less than fruitful.

    What I want to accomplish is to open a report that identifies all records with invalid VIN’s. It would show the RunNo (a distinct number), the VIN, and one of 4 different error descriptions (text). I tried to do this with a While Not rst.EOF loop that performed a RunSQL to append the records to a temporary table. It didn’t work Probably because I didn’t do it correctly, I’m sure.

    I’ve attached the code that does the error check as records are added to the “AvailAutos” table, which is also the RecordSource for the form the code runs from.

    Any help will be greatly appreciated.
    Kathi in Birmingham, AL

    Viewing 1 reply thread
    Author
    Replies
    • #796914

      You could create a function that checks the VIN, and returns True (pass) or False (fail). You could then create a query that returns only those records that fail, and use this as record source for the report.

      I have attached the database with an attempt at the function in the module basFunction, and a query qryFail.

      • #796964

        Hans,
        You are my hero!!!! Exactly what I needed. Thanks, Kathi

      • #796965

        Hans,
        You are my hero!!!! Exactly what I needed. Thanks, Kathi

    • #796915

      You could create a function that checks the VIN, and returns True (pass) or False (fail). You could then create a query that returns only those records that fail, and use this as record source for the report.

      I have attached the database with an attempt at the function in the module basFunction, and a query qryFail.

    Viewing 1 reply thread
    Reply To: Loop thru records to check for error (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: