Tabular Form

K

killeronloose

Hi,

I am looking to create form programmatically where the label (attached
control) should be in header section and the text box (parent control) should
be in detail section. I believe it is tabular form that I am looking to
create programmatically.

Help appreciated.
 
S

Stuart McCall

killeronloose said:
Hi,

I am looking to create form programmatically where the label (attached
control) should be in header section and the text box (parent control)
should
be in detail section. I believe it is tabular form that I am looking to
create programmatically.

Help appreciated.

I hpe you mean you want to create a form when in design view, because if you
want to create one at runtime, you're out of luck.

That said, take a look at the CreateForm and CreateControl methods in the
help file. Their use is easy to follow.
 
K

killeronloose

Hi,

I am able to use CreateForm and CreateControl to make a form with all
controls. But whenever I assign an attached control (label) to header section,
it appears in detail section only since the parent control (textbox) is in
detail section.

I am looking for VBA code for the situation where parent control and attached
control are in different sections as in tabular form created through Form
Wizard.


Stuart said:
[quoted text clipped - 5 lines]
Help appreciated.

I hpe you mean you want to create a form when in design view, because if you
want to create one at runtime, you're out of luck.

That said, take a look at the CreateForm and CreateControl methods in the
help file. Their use is easy to follow.
 
S

Stuart McCall

killeronloose said:
Hi,

I am able to use CreateForm and CreateControl to make a form with all
controls. But whenever I assign an attached control (label) to header
section,
it appears in detail section only since the parent control (textbox) is in
detail section.

I am looking for VBA code for the situation where parent control and
attached
control are in different sections as in tabular form created through Form
Wizard.

Ok, first off, Access won't do this automatically. You have to create the
label control in the form's header section yourself. To ensure the textboxes
in the detail section don't get 'auto-labelled', use code like this:

Dim frm As Access.Form
Dim ctl As Access.Control

Set frm = CreateForm()
Set ctl = frm.DefaultControl(acTextBox)
ctl.AutoLabel = False

This applies only to a form's default controls and cannot be set for a
control that's already on the form or report.

Other default control properties you can set in the same manner:

AddColon
LabelAlign
LabelX
LabelY
TextAlign

HTH
 
K

killeronloose

I guess then another option would be placing label and textbox in different
sections, independent of each other, and then selecting these controls
together and setting their layout as tabular.

So, a VBA code should -
1. Select label and textbox
2. Set their layout as tabular


Stuart said:
[quoted text clipped - 8 lines]
control are in different sections as in tabular form created through Form
Wizard.

Ok, first off, Access won't do this automatically. You have to create the
label control in the form's header section yourself. To ensure the textboxes
in the detail section don't get 'auto-labelled', use code like this:

Dim frm As Access.Form
Dim ctl As Access.Control

Set frm = CreateForm()
Set ctl = frm.DefaultControl(acTextBox)
ctl.AutoLabel = False

This applies only to a form's default controls and cannot be set for a
control that's already on the form or report.

Other default control properties you can set in the same manner:

AddColon
LabelAlign
LabelX
LabelY
TextAlign

HTH
 
S

Stuart McCall

killeronloose said:
I guess then another option would be placing label and textbox in different
sections, independent of each other, and then selecting these controls
together and setting their layout as tabular.

So, a VBA code should -
1. Select label and textbox
2. Set their layout as tabular

Well perhaps a better option would be to position the controls as they're
created, using the top, left, width & height properties. That's the way I'd
do it - in fact I have, and more than a few times. I've been looking through
some archived code to try & extract some to illustrate the technique, but
I'm finding that everything contains app-specific code, the presence of
which would cloud the issue. If I find something and have time this evening
to tweak it into something postable, I will post it.
 
K

killeronloose via AccessMonster.com

Indeed positioning controls using top, left, width and height properties in
different sections has to be executed. But I can't seem to find any code that
can help attach label in header section to textbox in detail section.

Seems not everything is covered by VBA.

Thanks for helping.

Stuart said:
I guess then another option would be placing label and textbox in different
sections, independent of each other, and then selecting these controls
[quoted text clipped - 3 lines]
1. Select label and textbox
2. Set their layout as tabular

Well perhaps a better option would be to position the controls as they're
created, using the top, left, width & height properties. That's the way I'd
do it - in fact I have, and more than a few times. I've been looking through
some archived code to try & extract some to illustrate the technique, but
I'm finding that everything contains app-specific code, the presence of
which would cloud the issue. If I find something and have time this evening
to tweak it into something postable, I will post it.
 
S

Stuart McCall

killeronloose via AccessMonster.com said:
Indeed positioning controls using top, left, width and height properties
in
different sections has to be executed. But I can't seem to find any code
that
can help attach label in header section to textbox in detail section.

Seems not everything is covered by VBA.

Thanks for helping.

Stuart said:
I guess then another option would be placing label and textbox in
different
sections, independent of each other, and then selecting these controls
[quoted text clipped - 3 lines]
1. Select label and textbox
2. Set their layout as tabular

Well perhaps a better option would be to position the controls as they're
created, using the top, left, width & height properties. That's the way
I'd
do it - in fact I have, and more than a few times. I've been looking
through
some archived code to try & extract some to illustrate the technique, but
I'm finding that everything contains app-specific code, the presence of
which would cloud the issue. If I find something and have time this
evening
to tweak it into something postable, I will post it.

To my knowledge it's not possible to attach a label to a control in a
different section. I've just had a look at your previous posts and seen that
you mentioned it more than once, but I missed it. Why is it important for
the label to be attached?

I did have a search through my archive for an example, but was unable to
locate anything that would require a lot of re-working to make it postable,
sorry. But it sounds like you don't need it now anyway.
 
K

killeronloose via AccessMonster.com

Yeah, my query was more out of curiosity than need.

Thanks for helping.

Stuart said:
Indeed positioning controls using top, left, width and height properties
in
[quoted text clipped - 23 lines]
To my knowledge it's not possible to attach a label to a control in a
different section. I've just had a look at your previous posts and seen that
you mentioned it more than once, but I missed it. Why is it important for
the label to be attached?

I did have a search through my archive for an example, but was unable to
locate anything that would require a lot of re-working to make it postable,
sorry. But it sounds like you don't need it now anyway.
 

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

Top