whats wrong with this?

Zelo

Registered User.
Local time
Today, 13:06
Joined
Mar 9, 2007
Messages
35
i have table works. and each record (work) has work_status. i need to count, how many works has work_status = 3
i wrote i query
dim b as integer
b = Count("SELECT [work_status] FROM [Works] WHERE [work_status] = 3")

compile wrote: wrong number of arguments or invalid prperty assigment.

I don' know, where i have made mistake. Could you help me?
 
Try the DCount Function as follows

b = DCount("SELECT [work_status] FROM [Works] WHERE [work_status] = 3")
 
oh, thank, I made like this
b = DCount "[work_status]", "Works", "[work_status] = 2"),
and it's working.
but i have another question. Could i add another criteria to this one? That dcout ount only those records, which have the same for example "order_id"?
table is the same.
 
You can add further criteria's, example

b = DCount "[work_status]", "Works", "[work_status] = 2 AND [order_id] = 1")
 
I have this code

Dim orders_nr As Integer
orders_nr = Forms!orders!order_id

Dim b As Integer
b = DCount("[work_status]", "Works", "[work_status] = 2 And [orders_nr] = " & orders_nr & "")

And compile write You canceled the previous operation
 
Try the following

DCount("[work_status]", "Works", "[work_status] = 2 And [orders_nr] = " & orders_nr)
 
i found a problem, and thank you for help
 

Users who are viewing this thread

Back
Top Bottom