Results 1 to 4 of 4
  1. #1
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202

    Two Criteria and Date in VBA


    Good afternoon, I am attempting to write vba to open another form based on today's date and [EmployeeID] in a list. I currently have

    Dim strCriteria As String
    strCriteria ="[EmployeeID] = " & Me.lstDailyProductivity.Column(0)
    DoCmd.OpenForm"frmLogProcedurePopUp", , ,strCriteria, , acDialog
    End Sub

    which will pull up all the entries by the employeeID clicked in the list. Works great. What I need is to limit the results to today only. Struggling with the Date and a second criteria. Any help would be appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    And what field holds date value you need to filter on? What have you attempted?

    strCriteria ="[EmployeeID] = " & Me.lstDailyProductivity.Column(0) & " AND DateField=Date()"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    Perfect! Thank very much. the () kept dissappearing. forgot the quotes. Thanks again

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    You probably tried concatenating Date() function which would require # delimiters. VBA will drop the (). Since Date() is an intrinsic function, the WHERE CONDITION argument will evaluate when embedded between quotes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 13
    Last Post: 01-30-2019, 05:55 PM
  2. Replies: 21
    Last Post: 08-16-2016, 09:46 AM
  3. Replies: 2
    Last Post: 04-02-2015, 12:45 PM
  4. Date criteria using between and form date picker
    By killermonkey in forum Queries
    Replies: 3
    Last Post: 03-21-2013, 12:44 PM
  5. Replies: 3
    Last Post: 08-21-2012, 03:05 PM

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