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
Register
| FAQ | Members List | Calendar | 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
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

Reply With Quote
Reply


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
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



All times are GMT -4. The time now is 10:19 AM.


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