Module for checking table data contains certain dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BerkshireGuy

    #1

    Module for checking table data contains certain dates

    I have a Access database that should have data for each weekday of the
    year. There is a field called DateDownloaded, which should have at
    least one record for each weekday of the current year.

    Does anyone know of existing code that would check to make sure each
    weekday has at least one record and if not, write that date to a temp
    table or output to a report?

    Thanks
    Brian

  • Allen Browne

    #2
    Re: Module for checking table data contains certain dates

    The simplest way to do this would be to create a table with all working
    dates in it. Omit (or delete) weekends and public holidays if desired. You
    can then use the Unmatched Query Wizard to find the records in this table
    that have no match in your other table.

    Create a table with one Date/Time field named TheDate. Mark the field as
    primary key. Save the table with the name tblDate. You can now use the
    function below to populate it with all the dates you want.

    Function MakeDates(dtSta rt As Date, dtEnd As Date) As Long
    Dim dt As Date
    Dim rs As DAO.Recordset

    Set rs = DBEngine(0)(0). OpenRecordset(" tblDate")
    With rs
    For dt = dtStart To dtEnd
    .AddNew
    !TheDate = dt
    .Update
    Next
    End With
    rs.Close
    Set rs = Nothing
    End Function


    --
    Allen Browne - Microsoft MVP. Perth, Western Australia
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "BerkshireG uy" <berkshireguy20 05-commerical@yaho o.comwrote in message
    news:1182739122 .101275.127440@ g4g2000hsf.goog legroups.com...
    >I have a Access database that should have data for each weekday of the
    year. There is a field called DateDownloaded, which should have at
    least one record for each weekday of the current year.
    >
    Does anyone know of existing code that would check to make sure each
    weekday has at least one record and if not, write that date to a temp
    table or output to a report?
    >
    Thanks
    Brian

    Comment

    Working...