Results 1 to 2 of 2
  1. #1
    BeitersIT is offline Novice
    Windows 2K Access 2007
    Join Date
    Apr 2012
    Posts
    1

    Access 2007 Dcount

    Good day!,



    I am trying to build a simple database that would handle deliveries with multiple delivery areas, I have Two (2) tables

    Tbl-1 = M_D_Schedule

    ID - Auto Number PK
    Delivery Area - Related to Tbl-2
    Full Name -Text
    Address - Text
    Town - Text
    State - Text
    Zip - Number
    Phone - Number
    Invoice - Number
    Items - Memo
    Notes - Memo
    Dollar Value of Delivery - Currency
    Date Scheduled - MM/DD/YYYY

    Table Tbl-2 = M_D_Area
    ID - Auto Number PK Related to Tbl-1 - Delivery Area
    Direction

    What is happening is our satellite facilities would email the information excluding the Date Scheduled and our outlook would data collect the emails and auto enter the information in to our database (Working Great), Then periodically a team member would run a query choosing a specific delivery area where the Scheduled date IS NUll (Working Great)
    Now my problem On the form (with the above query run) we would call Customer and confirm a specific delivery date, I want to be able to put some code on the form (Date Scheduled Field) that would inform them if on that specific date they have have gone above a specific Threshold (i.e. 6 deliveries, or what ever we decide to choose) for the specific date and delivery area.Getting totally lost with this. I thought the Dcount would be my best option, I can get the Dcount to work with a single field but trying to do with multiple criteria is throwing me, CAn anyone help me out here and let me know what i am missing??

    My Original Code (Working) is
    If DCount("*", "M_tbl_Schedule") >= 5 Then
    MsgBox "Maximum number of records allowed has been reached", vbOKOnly + vbExclamation, "Day Full"
    'code to stop entry of new records
    Of course this is not looking at a specific area or Date

    Below is what i currently have and I am getting a compile error!!
    IF DCount=("[Date Scheduled] & [Delivery_Area]", "M_tbl_Schedule") >= 5 Then
    MsgBox "Maximum number of records allowed has been reached", vbOKOnly + vbExclamation, "Day Full"
    'code to stop entry of new records

    Any Insight would be greatly appreciated.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    The DCount does not have any criteria. Need something like:

    If DCount("*", "M_tbl_Schedule", "[Date Scheduled]=#" & date input here & "# AND [Delivery_Area]='" & area input here & "'") >= 5 Then

    The inputs can be an input box popup (don't advise as cannot validate user entry) or reference to a control on form, like: Me.tbxDateScheduled. If Delivery_Area is a number field, remove the apostrophe delimiters.
    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. Export Table in Access 2007 to Multiple Workbooks in Excel 2007
    By hutchinsm in forum Import/Export Data
    Replies: 5
    Last Post: 03-01-2012, 05:23 PM
  2. Ms Access 2007 report export to excel 2007
    By Stan2man in forum Access
    Replies: 6
    Last Post: 11-23-2011, 01:24 PM
  3. Linking Access 2007 to Outlook Calender 2007
    By izzygrace3 in forum Programming
    Replies: 1
    Last Post: 11-10-2011, 11:53 PM
  4. Replies: 2
    Last Post: 06-18-2011, 09:55 AM
  5. Replies: 0
    Last Post: 11-17-2009, 02:35 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