Solved Dlookup with count (1 Viewer)

theinviter

Registered User.
Local time
Today, 15:39
Joined
Aug 14, 2014
Messages
240
Dear guys:
I have Main form named "Statistics" and table named "pt data"
Due date
Date2 = date
Time2 = Time
Number of Rx text box.
button11

so i want upon clicking the botton11 to count the number of record in "pt data" field " due date" with criteria more than Date2 and time2.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:39
Joined
Oct 29, 2018
Messages
21,453
Do you really need a button for this? You should be able to use an unbound Textbox with a DCount() expression to get that information and have it displayed all the time. Just curious...
 

theinviter

Registered User.
Local time
Today, 15:39
Joined
Aug 14, 2014
Messages
240
Do you really need a button for this? You should be able to use an unbound Textbox with a DCount() expression to get that information and have it displayed all the time. Just curious...
ok but how to do it please
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:39
Joined
Oct 29, 2018
Messages
21,453
ok but how to do it please
You could try something like:
Code:
=DCount("*", "[pt data]", "[due date]>[Date2]+[Time2]")
Hope that helps...
 

theinviter

Registered User.
Local time
Today, 15:39
Joined
Aug 14, 2014
Messages
240
You could try something like:
Code:
=DCount("*", "[pt data]", "[due date]>[Date2]+[Time2]")
Hope that helps...
i tried this but it show me 0 but in reality's there is many record .
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:39
Joined
Oct 29, 2018
Messages
21,453
i tried this but it show me 0 but in reality's there is many record .
Since I cannot see your table, I can't tell you how to fix it. That was just a guess based on your description. If you can understand what I'm trying to do there, you should be able to replace what's wrong with the correct fields. Otherwise, you may have to post a sample copy of your db for us.
 

theinviter

Registered User.
Local time
Today, 15:39
Joined
Aug 14, 2014
Messages
240
Since I cannot see your table, I can't tell you how to fix it. That was just a guess based on your description. If you can understand what I'm trying to do there, you should be able to replace what's wrong with the correct fields. Otherwise, you may have to post a sample copy of your db for us.
thanks alot work successfully.
but now i want to add additional criteria based on "item class" in combo box named "type"
how to do it
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:39
Joined
Oct 29, 2018
Messages
21,453
thanks alot work successfully.
but now i want to add additional criteria based on "item class" in combo box named "type"
how to do it
You can add more criteria by simply using AND or OR between them. For example:
Code:
"ThisField=ThisValue AND ThatField=ThatValue"
Hope that helps...
 

theinviter

Registered User.
Local time
Today, 15:39
Joined
Aug 14, 2014
Messages
240
You can add more criteria by simply using AND or OR between them. For example:
Code:
"ThisField=ThisValue AND ThatField=ThatValue"
Hope that helps...
thanks alot done successfuly
 

Users who are viewing this thread

Top Bottom