Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the control source of unbound text box

Status
Not open for further replies.

Bodhis3mta3

Programmer
Feb 11, 2004
7
US
Just out of curiosity...

I'm AS/400 programmer who has graduated to building custom Access projects around the AS/400 database. I am trying to build forms for some of the "less pc familiar" execs to review daily figures and cut down on the amount of physical reports generated.

I have a linked table to the AS/400 file (fields W/E, CODE, DEPT, DAY1, DAY2, DAY3, etc.) which is then queried via a form that receives a W/E date along with a day number (i.e. Sunday = 1, Monday = 2, etc.) from text boxes which then runs the Requery macro AfterUpdate. At the moment I have seven bound text boxes on a report (repeated in the detail section) for each day. I am changing the visible property from false to true depending on which value is in the DAY form text box.

What I was wondering was is there a way to re-assign (through a macro or VBA or magic pixie dust) the control source of a single unbound text box on a report to a new field in a query (i.e. from DAY1 to DAY2) depending on the value in a form text box?

I've got all the database know-how, but it's an Access learn-as-you-go assignment. Any and all help would be greatly appreciated.
 
Me.YourTextBox.ControlSource = "YourField"
 
That is sweet! Thanks a million!
I had to rename my "Public Sub" to a "Function" and add it to my macro to automate it, but it ran like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top