Sabtu, 21 April 2012

[MS_AccessPros] Dcount Access 2007

 

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.

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar