Help with coding

N

NNlogistics

Does anyone see any problem with this code, displaying #error in
txtDCountofqryOrders

Forms!frmOrder.txtDCountofqryOrders.ControlSource =
"=DCount(""fldCustomerName"", ""qryOrderbyCustomer"")"

I am trying to change the control source from the cmd of another form.
 
D

Danny J. Lesandrini

Missing the field you should count. I've added the star *
Forms!frmOrder.txtDCountofqryOrders.ControlSource =
"=DCount(""*"",""fldCustomerName"", ""qryOrderbyCustomer"")"
 
N

NNlogistics

Danny thanks for the response. I still get the error. The dcount stament I
am using works in other places. "=DCount (""fldCustomerName"",
""qryOrderbyCustomer"")" is actually the 1st(Field to count) and 2nd(qry or
table). I left out the 3rd which is "where" because I have no conditions.

I think the problem is with the left side of = , I am getting #ERROR.
Wouldn't I get #NAME if it were the right side? Not sure about that but I
think the Dsum part is ok

--
Thanks for any assistance


Danny J. Lesandrini said:
Missing the field you should count. I've added the star *
Forms!frmOrder.txtDCountofqryOrders.ControlSource =
"=DCount(""*"",""fldCustomerName"", ""qryOrderbyCustomer"")"
 
D

Danny J. Lesandrini

I didn't know that about DCount()

I'm assuming you have spelled your form and controls correctly.
That having been said, why not put a bang (!) in front to the text
box instead of a dot (.) ?

Forms!frmOrder!txtDCountofqryOrders.ControlSource

It shouldn't make a difference, but sometimes I've seen code get
a little finicky about such trivial things.

Otherwise, it seems to evaluate correctly in the Debug window.
Running this ...
?"=DCount(""*"",""fldCustomerName"", ""qryOrderbyCustomer"")"

Evaluates and returns this ...
=DCount("*","fldCustomerName", "qryOrderbyCustomer")

I don't see anything wrong here.
--
Danny J. Lesandrini
(e-mail address removed)
www.amazecreations.com


NNlogistics said:
Danny thanks for the response. I still get the error. The dcount stament I
am using works in other places. "=DCount (""fldCustomerName"",
""qryOrderbyCustomer"")" is actually the 1st(Field to count) and 2nd(qry or
table). I left out the 3rd which is "where" because I have no conditions.

I think the problem is with the left side of = , I am getting #ERROR.
Wouldn't I get #NAME if it were the right side? Not sure about that but I
think the Dsum part is ok
 
N

NNlogistics

Danny, Thanks again. I tried that and every combination of !.[( I can think
of. I dont know. But thanks again and I really appreciate being able to
bounce ideas back and forth, keep um coming.
 
N

NNlogistics

Ling, thanks for the response but thats where I started. I'm loosing hope.
I guess I can approach this from some other angle but this should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top