Solved

Create Control and Runtime

Posted on 2004-08-23
4
338 Views
Last Modified: 2012-06-21
is it possible to create a control at run time? or on the click of a button is MS Access 2003? if so how?
0
Comment
Question by:Y2Kingswood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 85
ID: 11876553
Yes, but generally speaking it's very bad idea to do this. Anytime you add controls, you run the risk (matter of fact, it's almost CERTAIN) of decompiling your application, and a decompiled application is an unstable application. Yes, you can recompile and Compact after each one of thes operations, but that requires the user to exit the application - definitely not the best of operations.

However, if you must, lookup CreateControl in online help. There's a pretty good example of how to do this.
0
 

Author Comment

by:Y2Kingswood
ID: 11876866
see the thing is i dont want to have to do this in design view all i want is for the user to say for example i need 2 textbox then 2 textbox's will apear, i could have them hidden and have a limit on how many you could have but i didnt really want to do it like that
what do you think??
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 50 total points
ID: 11876997
Yes, you can add as many controls as you think you may need and set them all .Visible=False. When the users selects the # on controls, you'd just reset to .Visible=True. If you name your controls something like ctl1, ctl2, ctl3 etc, then you can do this ina loop

Assuming you have a textbox on your form named ctlNumOfControls

dim intCount as Integer

For intCount = 1 to Me.ctlNumOfControls
  Me.Controls("ctl" & cstr(intCount)).Visible = True
next intCount

To "reset" the controls back to invisible:

For intCount = 1 to TheTotalNumberOfYourControls
  Me.Controls("ctl" & cStr(intCount).Visible = False
Next intCount

0
 

Author Comment

by:Y2Kingswood
ID: 11877019
I think that will do nicely as CreateControl seems a bit extreme.
Thanks!
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question