Hi
Using Access XP (2002), I have a form where I move and resize label fields
in a scheduler application. Currently, I have created 20 invisible labels
on the form then as required, I alter the parameters (left, top, width,
height, colours) to suit the requirement of the data for the particular
date.
While my method works, is there a way where a label can be created using VBA
code ? This would make the application slicker.
Thanks
Peter
|
|
0
|
|
|
|
Reply
|
MacNews
|
10/1/2007 2:42:25 PM |
|
Sounds like a reasonable approach, Peter.
Duane Hookom has a sample database that sounds somewhat similar. You may
like to check what he suggests here:
http://www.access.hookom.net/Samples.htm
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MacNews" <glenties@Telstra.com> wrote in message
news:lH7Mi.4126$H22.3245@news-server.bigpond.net.au...
> Hi
>
> Using Access XP (2002), I have a form where I move and resize label fields
> in a scheduler application. Currently, I have created 20 invisible
> labels on the form then as required, I alter the parameters (left, top,
> width, height, colours) to suit the requirement of the data for the
> particular date.
>
> While my method works, is there a way where a label can be created using
> VBA code ? This would make the application slicker.
|
|
0
|
|
|
|
Reply
|
Allen
|
10/1/2007 3:04:48 PM
|
|
I think that you have the best method. To add controls at runtime, you need
to open the form in design view. You can, however move and show or hide
controls at runtime.
Here's some code that will add a label control to the Header of a from named
Form1:
Sub AddLabel()
Dim frm As Form
Dim lbl As Label
DoCmd.OpenForm "Form1", acDesign
Set frm = Forms("form1")
frm.Section(acHeader).Visible = True
Set lbl = CreateControl(frm.Name, acLabel, acHeader, vbNullString,
vbNullString, 100, 100, 1000, 230)
lbl.Caption = "Test Header"
DoCmd.Close acForm, "Form1", acSaveYes
Set lbl = Nothing
Set frm = Nothing
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
"MacNews" <glenties@Telstra.com> wrote in message
news:lH7Mi.4126$H22.3245@news-server.bigpond.net.au...
> Hi
>
> Using Access XP (2002), I have a form where I move and resize label fields
> in a scheduler application. Currently, I have created 20 invisible
> labels on the form then as required, I alter the parameters (left, top,
> width, height, colours) to suit the requirement of the data for the
> particular date.
>
> While my method works, is there a way where a label can be created using
> VBA code ? This would make the application slicker.
>
> Thanks
>
> Peter
>
>
>
>
|
|
0
|
|
|
|
Reply
|
Arvin
|
10/1/2007 3:17:27 PM
|
|
On Mon, 01 Oct 2007 14:42:25 GMT, MacNews wrote:
> Hi
>
> Using Access XP (2002), I have a form where I move and resize label fields
> in a scheduler application. Currently, I have created 20 invisible labels
> on the form then as required, I alter the parameters (left, top, width,
> height, colours) to suit the requirement of the data for the particular
> date.
>
> While my method works, is there a way where a label can be created using VBA
> code ? This would make the application slicker.
>
> Thanks
>
> Peter
The problem with your adding labels using VBA is that there is a limit
of 754 controls (even if you delete some) you can add to a form over
it's lifetime .
See Access Help + Specification + Access specifications + Forms and
Reports.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|
|
0
|
|
|
|
Reply
|
fredg
|
10/1/2007 4:14:35 PM
|
|
Hi Allen
Thanks - was of help. We're using the same idea but the demo did give me a
different approach.
Peter - also from Perth, Western Australia - small world.
"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:OPYjqxDBIHA.2268@TK2MSFTNGP02.phx.gbl...
> Sounds like a reasonable approach, Peter.
>
> Duane Hookom has a sample database that sounds somewhat similar. You may
> like to check what he suggests here:
> http://www.access.hookom.net/Samples.htm
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "MacNews" <glenties@Telstra.com> wrote in message
> news:lH7Mi.4126$H22.3245@news-server.bigpond.net.au...
>> Hi
>>
>> Using Access XP (2002), I have a form where I move and resize label
>> fields in a scheduler application. Currently, I have created 20
>> invisible labels on the form then as required, I alter the parameters
>> (left, top, width, height, colours) to suit the requirement of the data
>> for the particular date.
>>
>> While my method works, is there a way where a label can be created using
>> VBA code ? This would make the application slicker.
>
|
|
0
|
|
|
|
Reply
|
MacNews
|
10/1/2007 5:13:43 PM
|
|
|
4 Replies
1410 Views
(page loaded in 0.092 seconds)
|