Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2005, 11:21 AM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create/Add controls to Access Form: VBA program

Hello

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

Situation:
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.

 
Old October 13th, 2005, 06:48 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
Else
   Me.Textbox1.Visible = False
End If

HTH


mmcdonal





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





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