Changing continuous form header and data at runtime - suppressing columns

  • Thread starter Thread starter AlanD
  • Start date Start date
A

AlanD

The aim is to suppress most columns of a continuous form, depending on
runtime parameters.

I have a query which extracts fieldA, fieldB etc up to fieldZ.

I have a form with 4 text box controls and 4 labels.

I have a second query, which runs when the form opens, which essentially
selects 4 records, each holding a fieldname and a heading. (Example FieldQ,
HeaderQ in record 1 and FieldW, HeaderW in record 2 etc)

I need to programatically get my form to display fieldQ and HeaderQ in the
first pair of controls, fieldW and HeaderW in the second pair etc.

Using DAO what is the best method of doing this? Trying to loop through the
2nd dataset, building up the name of the label and modifying its caption
wasn't successful
( Label1.Caption = "Q" worked but
String = "Label1.Caption"
String = "Q" didn't work.)

Thanks for any suggestions or pointers.

AlanD
 
If I understand your problem, you want to (at run time)
select four columns from a particular table or query, and
use those columns as the bound recordset for your
continuous form.
To do this I would build an sql string that listed the
four selected fields, aliasing the four fields with the
declared control sources of the display text boxes, set
the form's record source to the sql string and then
requery the form.

If you need more help to do this, you can contact me at
chris
at
mercury-projects
dot
co
dot
nz
 
Thanks Chris. You pointed me in the right direction.

I eventually found the syntax for building up the name of a control (the
column header) and changing it:
LabelString = "Label" & Counter
Me.Controls(LabelString).Caption = newheader

AlanD
 
Back
Top