Wrox Programmer Forums
| 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 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 June 8th, 2008, 12:29 PM
sms sms is offline
Authorized User
 
Join Date: Apr 2008
Location: Satdobato, , Nepal.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default creaing user form with vba

Hi all,
Actually I want to create a userform using vba dynamically i.e I have to create labels, textboxes and so on dynamically at runtime. How can I do this?
thanks in advance.
 
Old June 13th, 2008, 07:32 AM
sms sms is offline
Authorized User
 
Join Date: Apr 2008
Location: Satdobato, , Nepal.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey all,
I got it. We can create dynamic user form as follows:
1. Ensure that the subform is not opened with the main form.
(me.subform.SourceObject="")

2. Open the subform in design view:
DoCmd.OpenForm msub_name, acDesign, , , acFormEdit, acHidden

3. Delete unnecessary controls from the subform
Call DeleteControl(msub_name, mcont.name)

4. Use the createcontrol function to add the necessary controls

5. Save the subform
DoCmd.Close acForm, msub_name, acSaveYes

6. In the main form, restore the sourceobject property of the subform
 
Old June 13th, 2008, 07:38 AM
sms sms is offline
Authorized User
 
Join Date: Apr 2008
Location: Satdobato, , Nepal.
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am so sorry.
I forget to say that we can create dynamic user form using a subform.
so firsy create a subform and try above steps.
thanks
 
Old June 13th, 2008, 07:50 AM
Authorized User
 
Join Date: May 2007
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i take it there's a reason for simply not hiding the controls in question from the user at opening depending on their security





Similar Threads
Thread Thread Starter Forum Replies Last Post
delete a user form using vba sms Access VBA 2 June 27th, 2008 07:15 AM
New VBA user has simple question Michele_Haywood Access 2 September 26th, 2006 03:52 PM
Creaing Dynamic generic Cust ID srichary BOOK: Beginning ASP 3.0 3 November 9th, 2004 08:54 AM
user defined functions in vba re_anu Access VBA 2 March 3rd, 2004 01:59 PM
VBA - Form refresh lxu XML 2 March 3rd, 2004 01:49 PM





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