473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How can we create an object (edit box, checkbox) at run time ??

overcomer
Hi,

This is related to Code Behind AutoForm question that I've posted yesterdat but no one replies to that.

What i want a solution for is I need to have a flexible page1 whereas the field/objects (fields from a certain table that were added/created dynamically in a separate page2) could be created in the page1 at run time (using VB code). I'm using MS Access 2003 in Windows XP environment.

I've tried the Load funciton but it's not working as the object does not have an index property in MS Access.

Your comments/suggestions will be a big help.

Thanks.

Regards,
Cindy
Nov 4 '08 #1
2 1261
FishVal
2,653 Expert 2GB
Hello, Cindy.

You may use CreateControl() method.
Keep in mind that form where control is being created has to be opened in design view and be not the form where CreateControl() method is being executed.
Below is a simple example.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3.     Dim strName As String
  4.  
  5.     strName = "Form2"
  6.     DoCmd.OpenForm strName, acDesign
  7.     CreateControl strName, acTextBox, acDetail, , , 100, 100, 2000, 250
  8.     DoCmd.OpenForm strName, acNormal, , , , acWindowNormal
  9.  
  10. End Sub
  11.  
As an alternative you may design form with a sufficient fixed number of controls and change their visibility as required.

Regards,
Fish
Nov 4 '08 #2
Thank you so much Fish... it is really a big help...
Nov 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Paul D. Sullivan | last post by:
I've been trying to find out how to increase the font size in the text entry fields in Invision Power Board 1.3 for a while. The part where you enter your post and do the quick reply and all that...
7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
3
by: Rudy | last post by:
Hello All! I get this error at this line Line 368: Len(e.Item.Cells(5).Text) - 1) Line 369: txtQty.Text = e.Item.Cells(5).Text ****Line 370: chkEbay.Checked =...
2
by: hazz | last post by:
Given the update query UPDATE Columns SET Include_in_Report = @Include_in_Report WHERE (ID = @Original_ID); Include_In_Report is a bit field in the table, represented as a...
1
by: Dhruba Bandopadhyay | last post by:
I have a DataGrid which has checkbox columns. The data source is a run-time created data set that I store in a session so I can rebind it during postbacks. I don't have a database or xml file, etc....
3
by: r.hein | last post by:
I've got a middle tier data object that I'm binding a gridview to, and I'm having some problems with the check box, and having it enabled. Let'd start with the middle tier object (and the...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
1
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a table with a field with a bit datatype. I use a gridview to edit that a row in that table. I use SQLDataSource and enable editbutton property to get a link to edit the row. That all...
1
by: Mel | last post by:
I have a grid view control with just to columns. The first column is a checkbox (active/inactive user) and the second column is just text (user full name). I want to be able to edit only the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.