Results 1 to 8 of 8
  1. #1
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81

    Can I use FindFirst method to find a date in a split form?

    I have a purchase order form I am working on and would like to be able to type in a date and use something like the FindFirst method on my split form to go to the record in the datasheet part. I still want to display all the records, just want to jump down to the date I am looking for... Also, I would like to order the form by date when I do whatever I do.

    I am doing something similar using a combobox and the FindFirst method to jump down to a certain PO#. Now on the PODate I'm stuck.

    I don't know how to type in a date... combobox? text box? Something else?

    And I don't think the FindFirst method works with text or dates. Actually, I don't understand the FindFirst method and was able to use it on the PO# only because I found someone else's code and made it work for me.

    Any idea how I can do this?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  3. #3
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    Thanks. That's helping me go in a good direction.

    Is there a way to use FindFirst with text also? Do you know of any resources that can explain the FindFirst method and it's uses? I've read the the article you posted, but I need something more for baby dB designers.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Steve Bishop has over 70 free youtube videos on vba programming. Excellent series.
    This one includes Recordset and FindFirst

  5. #5
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    Thank you. I watched those videos last fall, but didn't understand a lot of it. I bet now that I have more experience I can go back and actually comprehend what he's talking about. orange, you are the most helpful person. You point me in the right direction without giving me the exact answer then I am able to learn and understand what I am doing.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  7. #7
    CharissaBelle is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    81
    I have it working to go to the first record with a date, but what do I do if the date is null? Sometimes we start a PO and wait for a confirmation before going in and adding a date. If the value of my date combobox is null, I get this error: "Run-time error'3077': Syntax error in date expression."

    Here's my current code:

    Code:
    Private Sub cboDateFilter_AfterUpdate()
    
    Dim rs As DAO.Recordset
    
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[PODate] =#" & Me![cboFilter] & "#"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    
    End Sub

    Thank you.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Perhaps your expression should be

    FindFirst...... where the Date is a valid Date????

    You know your business, so you must know what you should do if there is no Date.
    You'll have to adjust your code to respect you business logic/rules.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 01-07-2015, 06:21 PM
  2. Replies: 1
    Last Post: 12-05-2014, 07:41 PM
  3. Replies: 6
    Last Post: 08-21-2014, 09:14 AM
  4. Replies: 5
    Last Post: 08-20-2014, 10:18 PM
  5. RST Findfirst date problem
    By ColPat in forum Programming
    Replies: 3
    Last Post: 08-09-2010, 07:28 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums