Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 11th, 2005, 11:21 AM
Registered User
Join Date: Oct 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create/Add controls to Access Form: VBA program


I need to add controls( textboxes, and Optiongroup) programatically to the original form and not new popup or design form.

I have a form "frmXYZ", I have a button on this form and when I click this button, I need to add two textboxes, and one optiongroup to the same form " frmXYZ".

Request is immediate, any help is appreciated!

Thanks a lot.

Reply With Quote
  #2 (permalink)  
Old October 13th, 2005, 06:48 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Put the controls on the form in designtime, then make them visible if you pass a certain parameter to the form. You can declare the variable in a module as

Public myVariable As Boolean (or whatever type)
myVariable = False

and then have your form check the value of that variable On Open. If that value is unchanged, then the textboxes stay invisible. If you click a button on your other form, have those buttons set the variable to True, and then when the form opens the textboxes will appear.

Form Code would look like:

If myVariable = True Then
   Me.TextBox1.Visible = True
   Me.Textbox1.Visible = False
End If


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding controls on vba form from an addin narendrapawar Pro VB 6 1 April 25th, 2010 04:59 PM
Create VBA Feedback Form neodjandre Excel VBA 0 October 16th, 2007 04:34 PM
Send Keystrokes to DOS Program from Access VBA Cosmos75 Access VBA 6 May 15th, 2007 06:24 PM
Installing a access database program in VBA MDrumm Access 4 August 22nd, 2005 02:48 AM
How to Create a Remote Access Program victorc VB How-To 0 September 30th, 2003 12:47 PM

All times are GMT -4. The time now is 03:08 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.