Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2006

Tip: Looking for answers? Try searching our database.

dynamically adding conmtrols at runtime to a form...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Pears - 23 Jun 2006 01:25 GMT
If I wanted to dynamically add new text box controls (or any control for
that matter) to a form at run time how would I go about doing this?

Thanks,  Brad
Marshall Barton - 23 Jun 2006 06:19 GMT
>If I wanted to dynamically add new text box controls (or any control for
>that matter) to a form at run time how would I go about doing this?

Making design time changes to a form (or report,macro,
module, table) at runtime is a really big No-No.

What you should do is precreate an adequate pool of
invisible controls and, when needed, make them visible and
set their other properties (Top, Left, etc).  Simple and
quick!

Tip - to make the pool easier to manage, name them with a
common prefix (e.g. txtA) and a sequential number suffix.
This way you can use a module level variable to hold the
number of the next available control.

With Me("txtA" & intX)
    .Top = . . .
    .Left = . . .
    .ControlsSource = " . . .
    .Visible = True
    intX = intX + 1
End With

Signature

Marsh
MVP [MS Access]

Brad Pears - 23 Jun 2006 16:11 GMT
Thanks for that...   I was hoping to be able to simple create/remove hidden
controls (to be used for criteria info) on the fly for a particular
application but I suppose I could do what you suggest.

Thanks,
Brad

>>If I wanted to dynamically add new text box controls (or any control for
>>that matter) to a form at run time how would I go about doing this?
[quoted text clipped - 19 lines]
> intX = intX + 1
> End With
Marshall Barton - 23 Jun 2006 19:45 GMT
Working with a precreated set of invisible controls is
actually easier than creating new controls. so don't be too
disappointed  ;-)
Signature

Marsh
MVP [MS Access]

>Thanks for that...   I was hoping to be able to simple create/remove hidden
>controls (to be used for criteria info) on the fly for a particular
[quoted text clipped - 25 lines]
>> intX = intX + 1
>> End With
eos - 27 Jun 2006 14:51 GMT
AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George

 
eos - 27 Jun 2006 14:51 GMT
AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George

 
eos - 27 Jun 2006 14:51 GMT
AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George

 
eos - 27 Jun 2006 14:51 GMT
AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George

 
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.