+ Reply to Thread
Results 1 to 2 of 2

Count total number of records in access database using condition

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Count total number of records in access database using condition

    Hi guys

    I am using Access as a backend and Excel as a frontend. I want to count total number of records for todays where Time<13:01

    Can anyone please modify the following code accordingly?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Count total number of records in access database using condition

    if rs.Fields("Time")<"#13:01:00#" then Maybe??? Also, why not use SQL to give you the count?


    "select count(ID) from table1 where Date = #" & Format(Now, "mm/dd/yyyy") & "# AND WHERE Time<='13:00'"


    What are your data types? You seem to have date for the date, but is time a string value?
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Query Access database and return all records to Excel
    By bfs3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2014, 11:01 PM
  2. [SOLVED] Using Variables to add new records to Access Database
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2013, 09:17 PM
  3. Populate listbox with records from Access database
    By chinaboy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-07-2012, 08:06 AM
  4. Deleting all records in a access database table from Excel
    By Dave31 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2008, 02:18 PM
  5. [SOLVED] What formula/fn would I use to count multiple condition records?
    By Joshcat99 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-26-2005, 09:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1