Control source in an 'Unbound' control ?

  • Thread starter Thread starter Isis
  • Start date Start date
I

Isis

I have various unbound Text controls on a Form - at the moment I can type a
formula into the Control Source code point - as some of the code I want to
use is long and complicated. I would like to put it into a routine
somewhere - how do I do that and how do I tell the control to use it ?

Thanks
 
Put the code in a Public function in a standard module. Then set the
control's contro source to:
=FunctionName()
 
Dave, Thanks for the reply. OK 4 hours messing around and I have to admit
defeat.

At the moment I have a test List - the Rowsource was;
SELECT UID, SalesDate AS DateOne, CSSales FROM WhiteBoard;

and this returned the 3 data Fields as expected - I want to move the
Rowsource code to somewhere I can manage it better so I have been trying
to declare a Function as you suggested. How do I do that ?

If I try and put the SQL statement above onto a button and code it
something like;
me.TestList.RowSource = SELECT UID, SalesDate AS DateOne, CSSales FROM
WhiteBoard;

I get an immediate compiler error highlighting the UID (which is a Field
in Whiteboard).

There is obviously something I really don't understand here at all. Is
Access happy with standard SQL statements ? I want to put some of my
query code into routines that I can reuse.

Any help here would be much appreciated.

Thanks
 
RowSource is a text property, so you have to give it a string:

me.TestList.RowSource = "SELECT UID, SalesDate AS DateOne, CSSales FROM
WhiteBoard"
 
RowSource is a text property, so you have to give it a string:

me.TestList.RowSource = "SELECT UID, SalesDate AS DateOne, CSSales FROM
WhiteBoard"

Thanks for that Doug - think I need to quit for the night :-)

Regards
 
Back
Top