Goto first Null Record

Posted on 2006-04-13
Last Modified: 2012-05-05
I have a table that lists all the days of the year with fields: Date and Yards.  The idea is to enter a number of yards for each day of the year.
I have a form (in datasheet view) that allows the user to enter the number of yards for each date.  Right now - when the form/datasheet opens - it goes automatically to 1/1/2006 (because that is the first record of the table).  What function/event can I use so that the form will open and find the first null value in the Yards field?  (avoiding the scrolling to the next empty record).
Question by:iamlori
    LVL 10

    Accepted Solution

    DoCmd.OpenForm "FrmName",,,"[Yard] = " & Null

    That should work.

    LVL 9

    Expert Comment

    Try this on Form Open event

    Dim rs As DAO.Recordset
    Set rs = Me.Recordset
    rs.FindFirst "[Yard] Is Null"
    LVL 30

    Assisted Solution

    Private Sub Form_Open(Cancel As Integer)
        Dim rs As Recordset
        Set rs = Me.RecordsetClone
        rs.FindFirst "[Yards] IS NULL"
        Me.Bookmark = rs.Bookmark
    End Sub
    LVL 44

    Expert Comment

    Remember, Date is an Access function and should never be used as a table, field, or variable name.  If you absolutely have to, remember is must always be surrrounded by brackets when you make reference to it in a query or a module.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    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…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now