Changing Control Source

N

NNlogistics

I am using a popup form to supply some information to another form
(frmOrder). On that popup I want to use the click event on a cmd button to
change a control source for a text box. I am using

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

Getting the usual #Name?
I think I isolated it to the left side of code. Not positive. But it works
everywhere else and looks pretty good to me.
 
B

Beetle

To do this you need to assign the Control Source as a string, and
it needs to begin with an = sign like;

MyTextBox.ControlSource = "=DCount('fldCustomerName', 'qryOrderbyCustomer')"
 
N

NNlogistics

Thanks Beetle

almost there

unfortunetly now I'm getting#ERROR#

I Changed the code to

Forms!frmOrder.txtDCountofqryOrders.ControlSource =
"=DCount('fldCustomerName', 'qryOrderbyCustomer')"
and I added
MsgBox ("Test " & DCount("fldCustomerName", "qryOrderbyCustomer"))
and get what I want "9"
 

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

Similar Threads


Top