control source

maxmangion

AWF VIP
Local time
Today, 17:41
Joined
Feb 26, 2003
Messages
2,805
is it possible to change the control source of an unbound text box ?

For example i have a textbox which simply displays the number of current records displayed i.e. =DCount("*", "queryname")

Now i wanted that with the click of a button (or something), i wanted to change it's controlsource to =DCount("*", "queryname2") ... however, as a result i got #name instead of the correct count.

Thanks
 
Can you post the code you are using to have it change the source?

Is it possible that you simply have a spelling error in the name of the new control? I know this sounds stupid, but I've spent days trying to fix lines of code in databases only to find out that the problem was a stupid spelling error in my code (very frustrating after hours of reprogramming work).
 
Yes, you can change the controlsource.

Just remember to bulk up on the " because you are assigning a string.

Me.MyControl.ControlSource = "=DCount("""*""", """queryname2""")"
 
thank you the " was the problem ... actually, with reference to my other thread, following your suggestion of using the querydef, i do not think that i will be using this now, but it is good to know it, for future reference :)

Thank You
 
Just to let you know that with """*""", """queryname""" i got a syntax error message, however with just 2 i.e. ""*"", ""queryname"" it worked fine. :)

Thanks
 
I got over-eager with the " :D
 

Users who are viewing this thread

Back
Top Bottom