f



Programically Create Sub-Form - attach to Parent Form

Hope someone can help.

I have a saved parent form containing an unbound sub-form.   I set the
SourceObject (form) after the Parent Form opens/loads.

The sub-form (datasheet view) basically displays the results of a
cross-tab query   The cross-tab query is created dynamically (in code)
as the column headings are subject to change.

I therefore have to create a new form (in code) and add the necessary
controls (fields) as per the fields in the cross-tab query.

The reason why I want a form as the SourceObject of the sub-form is
that it allows Event Procedures to be activated.   Using a straight
query (in my case a cross-tab query) as the SourceObject, I can't see
how I can activate any click or double-click events in the query cells
(I hope I'm wrong about this).

I've now noticed that this approach doesn't work in an MDE file as the
design mode is off.

Any suggestions or work-arounds.

Steve.

0
9/20/2006 2:45:33 AM
comp.databases.ms-access 42670 articles. 0 followers. Post Follow

5 Replies
655 Views

Similar Articles

[PageSpeed] 17

On 19 Sep 2006 19:45:33 -0700, "superjacent" <superjacent@gmail.com>
wrote:

It is true that there is no code generation in MDE. Thank Bill for
that :-)
If you MUST have MDE, you have to relax your requirements. 

I haven't tried, but perhaps you can create a subform with the maximum
number of fields, and then bind them on the fly based on how many
columns your crosstab outputs.

-Tom.


>Hope someone can help.
>
>I have a saved parent form containing an unbound sub-form.   I set the
>SourceObject (form) after the Parent Form opens/loads.
>
>The sub-form (datasheet view) basically displays the results of a
>cross-tab query   The cross-tab query is created dynamically (in code)
>as the column headings are subject to change.
>
>I therefore have to create a new form (in code) and add the necessary
>controls (fields) as per the fields in the cross-tab query.
>
>The reason why I want a form as the SourceObject of the sub-form is
>that it allows Event Procedures to be activated.   Using a straight
>query (in my case a cross-tab query) as the SourceObject, I can't see
>how I can activate any click or double-click events in the query cells
>(I hope I'm wrong about this).
>
>I've now noticed that this approach doesn't work in an MDE file as the
>design mode is off.
>
>Any suggestions or work-arounds.
>
>Steve.

0
9/21/2006 2:09:39 AM
Initially I was using a saved form and programically removing and
adding controls as needed.   Eventually this approach didn't work,
after a few days, after heaps of testing an error message claimed that
I'd used all the controls available.   I suppose Access keeps a record
of previously deleted controls and I exceeded the limit.

So then I decided to programically create the sub-form from scratch and
therefore avoid the too many controls issue as mentioned above.   This
failed in that I can't use this approach in an MDE (hence the posting).

I suppose what you suggest is do-able, using a saved form, that
contains, say a 100 controls (would never need that many - would be
between 12-20) and set the record sources etc when needed.   I didn't
think of that approach a few days ago, as I would have tried it.

I've since solved my problem by utilsing a listbox as the displaying
object and changing the row soure, columnwidths, columncount etc as
required for the cross-tab.   I shied away from this approach at the
start as it seemed like a lot of work to double-click on particular
row/column.   In the end I had no choice and subsequently messed around
with the mousedown and doubleclick events to achieve what I wanted.

Thanks for your input and advice.

Steve.


Tom van Stiphout wrote:
> On 19 Sep 2006 19:45:33 -0700, "superjacent" <superjacent@gmail.com>
> wrote:
>
> It is true that there is no code generation in MDE. Thank Bill for
> that :-)
> If you MUST have MDE, you have to relax your requirements.
>
> I haven't tried, but perhaps you can create a subform with the maximum
> number of fields, and then bind them on the fly based on how many
> columns your crosstab outputs.
>
> -Tom.
>
>
> >Hope someone can help.
> >
> >I have a saved parent form containing an unbound sub-form.   I set the
> >SourceObject (form) after the Parent Form opens/loads.
> >
> >The sub-form (datasheet view) basically displays the results of a
> >cross-tab query   The cross-tab query is created dynamically (in code)
> >as the column headings are subject to change.
> >
> >I therefore have to create a new form (in code) and add the necessary
> >controls (fields) as per the fields in the cross-tab query.
> >
> >The reason why I want a form as the SourceObject of the sub-form is
> >that it allows Event Procedures to be activated.   Using a straight
> >query (in my case a cross-tab query) as the SourceObject, I can't see
> >how I can activate any click or double-click events in the query cells
> >(I hope I'm wrong about this).
> >
> >I've now noticed that this approach doesn't work in an MDE file as the
> >design mode is off.
> >
> >Any suggestions or work-arounds.
> >
> >Steve.

0
9/21/2006 10:34:51 AM
Per superjacent:
>The sub-form (datasheet view) basically displays the results of a
>cross-tab query   The cross-tab query is created dynamically (in code)
>as the column headings are subject to change.
>
>I therefore have to create a new form (in code) and add the necessary
>controls (fields) as per the fields in the cross-tab query.

When I do reports based on cross-tab queries (columns=dates, for instance) I
create a report with more columns and column headers than I'll ever need.

I name them txtColnn and lblColnn and set .Visible=False.

In Report_Open, I open up .RecordSetClone, iterate through .Fields(i).Name and
let lblColnn.Caption and txtColnn.ControlSource accordingly - making
..Visible=True while I'm at it.

-- 
PeteCresswell
0
PeteCresswell
9/21/2006 1:45:41 PM
(PeteCresswell) wrote:
> Per superjacent:

> When I do reports based on cross-tab queries (columns=dates, for instance) I
> create a report with more columns and column headers than I'll ever need.
>
> I name them txtColnn and lblColnn and set .Visible=False.
>
> In Report_Open, I open up .RecordSetClone, iterate through .Fields(i).Name and
> let lblColnn.Caption and txtColnn.ControlSource accordingly - making
> .Visible=True while I'm at it.

Yes, that all makes sense.

Steve.

0
9/21/2006 9:47:28 PM
Per superjacent:
>> In Report_Open, I open up .RecordSetClone, iterate through .Fields(i).Name and
>> let lblColnn.Caption and txtColnn.ControlSource accordingly - making
>> .Visible=True while I'm at it.
>
>Yes, that all makes sense.

Never tried it with a form... but it seems like it ought to work.   
-- 
PeteCresswell
0
PeteCresswell
9/21/2006 11:02:53 PM
Reply:

Similar Artilces:

Sub-forms of Sub-forms
I'm creating a data-entry form for 3 tables. There is a one-to-many relationship between table1 and table2 and a 2nd one-to-many between table2 and table3. What I would like to do is have the user select from a combo box on the main form a record from Table1. That would filter the subform on the main form to just the records from Table2 with the PK from Table1. I've got everything working fine up to this point, but am a bit confused on where to go next. I need a mechanism for the user to pick one of the records from Table2, and be presented with an entry for for all records in Tab...

Form
I have a table TBL_NAMES : IDNAME , Name_person , ETC..... (15 different labels) I have a second table TBL_POINTS : IDPOINTS , LINKNAME_PERSON , POINTS_ALGEBRA , POINTS_GYM , etc.... (25 courses) I have made a form where all the names are listed and when i click on a name another form is opened with that persons name on top and a number of labels and textboxes where i put those points in. So far no problem. BUT... i want one record per person. So the next time i click on his name i would like to see those points and be able to change them but i must not be able to create a new record. T...

Query By Form Using Same Sub Form and Main Form
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on another main and sub form. The requery on the sub form and refresh comands on the main form do not work when the form is first displayed and when the selection criteria is changed. Should I be doing a refresh and then repaint of the sub form. > ' Creates saved query in the database container for the sub form Call BuildSql("") ' The following commented line correctly displays query results on a seperate sub form that has the results from the criteria selected on the form currently in use. 'Docmd.OpenForm "MainFormSeachResults ' The following two lines attempt to display the results on a sub form which is on the same form where the criteria is selected: Me.frmSubFormResults.Requery Me.Refresh < Hi Tom, I often use an unbound main form to collect criteria, then show the results in a datasheet-style subform. I create the SQL string using code, and then use that string as the Recordsource for the subform directly (no need to save it as as query in the the database container) As an added bonus, the subform refreshes automatically ... no need to "Refresh" or "Repaint" anything. Here's some sample code to illustrate: - lstFieldNames is a listbox containing field names ... which is one of the choices in the listbox&#...

Mulitple Main Forms Created by Sub Form Entries
Hi I'm hoping this is a problem just because I'm a beginner at Access, and so someone can help I have created a database of companies, with a subform for contacts. (seperate tables) It worked perfectly until I got more than one contact for a company! If I add a 2nd contact to the subform, when I go back into the database, Ive got 2 records of the main form for the company, with the subform, showing. Its not adding a second record to the company table, that just says I have 2 contacts attached, which is what I want. How do I stop the record, when I view the form , duplicating its...

Forms and Form
Hi everyone ! 1) An example from help: "Each Form object has a Controls collection, which contains all controls on the form. You can refer to a control on a form either by implicitly or explicitly referring to the Controls collection. Your code will be faster if you refer to the Controls collection implicitly. The following examples show two of the ways you might refer to a control named NewData on the form called OrderForm: ' Implicit reference. Forms!OrderForm!NewData ' Explicit reference. Forms!OrderForm.Controls!NewData The next two examples show how you might refer to a ...

ms access: How do you create an about form button??
My son is trying to create an about form button for a form he has already created. Any help would be great. Thanks Open the form that will hold the button in Design View. Choose View, Toolbox to make the Toolbox available if it is not active. Make sure the Control Wizards button on the Toolbox is activated. Click once on the Command Button in the Toolbox. Click somewhere on the form that will hold the button. This will launch the Command Button Wizard. >From the Categories Pane, choose Form Operations. >From the Actions Pane, choose Open Form and click Next. The Command Button Wizard...

Making MS Access Form as a standalone form like in VB
Well, its sames difficult for me; I love access so much and wish to make it perform extra task. I prepared an HTML form but can not connect it to my access table and so I think it is possible to make an access form a standalone form for user input. Can anyone assist. My mail add is dianafather@aim.com. *** Sent via Developersdex http://www.developersdex.com *** Oscar, why don't you just code up a VB form for user input and connect it to an Access backend? To my knowledge, you can't force an Access form to exist outside of Access. Your users would have to open the Access file to ent...

Forms/Subforms in MS Access Database
Why do my Forms/Subforms in my MS Access Database not appear? All I see is the boxes where they should show?! What did I do wrong? Thanks, John zufie wrote: > Why do my Forms/Subforms in my MS Access Database not appear? > > All I see is the boxes where they should show?! > > What did I do wrong? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Probably there isn't a name of a form in the sub-form's Source Object property. Also, the Link Child Fields and the Link Master Fields properties may be blank - you must enter the names of the link fields, they hold the field names that link the data between the forms. -- MGFoster:::mgf00 <at> earthlink <decimal-point> net Oakland, CA (USA) ** Respond only to this newsgroup. I DO NOT respond to emails ** -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQA/AwUBSSsUjoechKqOuFEgEQL+dQCfYUSwXFtPj0RRSZO+q3J8lQCD0/UAniRz JKu0h9AG0BAg8W3wC/0BC7B3 =Kvva -----END PGP SIGNATURE----- On Nov 24, 2:54=A0pm, MGFoster <m...@privacy.com> wrote: > zufie wrote: > > Why do my Forms/Subforms in my MS Access Database not appear? > > > All I see is the boxes where they should show?! > > > What did I do wrong? > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Probably there isn't a name of a form in the sub-form's Source Object > property. =A0Also, the Link Child Fields and the Link Master Fields > properties...

Create MS/ACCESS database app for non-ms/access users
Is it possible to create an MS/ACCESS database application and package it for users who do not have MS/ACCESS loaded in their PCs? I was told that this is possible, but I don't know what software is needed. Do you know? If so, please answer this post. Thanks. SueB *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Per Sue Bricker: >Is it possible to create an MS/ACCESS database application and package >it for users who do not have MS/ACCESS loaded in their PCs? > >I was told that this is possible, but...

Form size question with Access forms, remote desktop, and MS Surface Pro
Hi, I know this is a stretch to ask this question, but: We have an Access 2010 application hosted using Remote Desktop. When we access forms from the desktop they look like they should. And from an iPad. However, a client is using their Surface Pro the forms are so tiny that she can't use them when accessing our application "on the cloud". Otherwise, they look fine on a Surface Pro when running it off the cloud. Does anyone have an idea? I do not think there is anything that the people that are hosting our software can do. -paulw On Monday, 29 February 2016 17:30:11 UTC, PW wrote: > Hi, > > I know this is a stretch to ask this question, but: > > We have an Access 2010 application hosted using Remote Desktop. When > we access forms from the desktop they look like they should. And from > an iPad. However, a client is using their Surface Pro the forms are > so tiny that she can't use them when accessing our application "on the > cloud". Otherwise, they look fine on a Surface Pro when running it > off the cloud. > > Does anyone have an idea? I do not think there is anything that the > people that are hosting our software can do. > > -paulw It will cost you, but have a look at a program called "ShrinkerStrether from Peter's Software (http://www.peterssoftware.com/ss.htm) This should shrink or stretch forms and all their controls to match the scr...

form access to form excel
Hello, How may I pass in VBA a value from a control in a access 2003 form to a control in a excel 2003 form ? I try this but it does'nt run: (oApp=word.application) oApp.Forms("saisie").tbnom.Value = Form_Form1.tbnom.Value & " " & Form_Form1.tbprenom.Value Thanks. ...

Continuous Forms with sub-form
I have a need to create a form containing schedule detail with a sub-form containing a crosstab of date detail. I would like to display it as a continuous form so the user can see related schedules together with the dates. Is there a way to get Access to do this? It won't allow continuous forms with sub-forms. Filling unbound controls on the main form only show the current record's date information. I would prefer not to use a big un-normalized temp table. On Wednesday, December 18, 2013 7:10:34 AM UTC-6, Ron Paii wrote: > I have a need to create a form containing schedule detail with a sub-form > > containing a crosstab of date detail. I would like to display it as a > > continuous form so the user can see related schedules together with the > > dates. Is there a way to get Access to do this? It won't allow continuous > > forms with sub-forms. Filling unbound controls on the main form only show > > the current record's date information. I would prefer not to use a big > > un-normalized temp table. Use a datasheet? Ron Paii wrote: > I have a need to create a form containing schedule detail with a > sub-form containing a crosstab of date detail. I would like to > display it as a continuous form so the user can see related schedules > together with the dates. Is there a way to get Access to do this? It > won't allow continuous forms with sub-forms. Fil...

I need to create a sub sub form
Hey there, My form displays info into a subform based on information chosen from 2 combo boxes. Can I somehow inside the subform, have 2 more combo boxes, thus drilling down even more to display a 2nd subform with data filtered from the recordset of the subform? Whats the easiest way to do this? Any help is appreciated, thanks! -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200805/1 ...

has anyone ever created a continuous data form (similar to MS Access)?
I think I just found a limitation to MS Access continuous form view where I was least expecting it :/ I wanted to do a quick'n'dirty solution, to display *different* elements of such a form based on data. Like... a type field, and if that is A, display text field a, if the type is B, display combobox b. Since this seems impossible in MS Access, I am starting to look for a not-so-quick & (maybe not so) dirty solution. So I was wondering if anyone has tried creating such an endless form in a wxWidgets application yet (other recommendations are most welcome). I w...

MS Access Create form / report with multiple pages using different background images
MS Access Create form / report with multiple pages using different background images Hi, Would like to have users fill out a multipage form, and then click a print button, which pulls up the info just entered for a particular record and print out multiple pages of forms, each page having a different image as background. 1) Anyone know how to make a form with multiple pages that different images as background? 2) Anyone know a way to create a multipage report where each page has a different background image (but the data across all of the pages come from the same record)? Thanks, George ...

calling a form sub from another form
Hi All This might sound simple, but I'm stumped. In essence I have a 2 form app that connects to an SQL db and extracts info from it. This works fine. The problem is with my 2nd form. The 'run through' is that the user can select an inv no from a combo box on form1 and when they select one, I auto-extract info from a db relating to this inv no, concat the various data fields with 2 other text fields (contains footer info) that are on form 2 and present it in a large text box on form 1. This also works fine. The problem is that the user may be previewing the large text box da...

Populate key from form to sub-form
I'm trying to figure out how to bring the key field from a parent form to populate the corresponding field in the sub-form during data entry, or to filter sub-form records during data viewing and updating. Can anyone help me? Bob Bob Mikels wrote: > I'm trying to figure out how to bring the key field from a parent form to > populate the corresponding field in the sub-form during data entry, or to > filter sub-form records during data viewing and updating. > > Can anyone help me? Use the subform's Link Master Fields & Link Child Fields properties. See...

Access Form --> Hyperlink to Excel --> Return to Original Access Form ?
I have an Access 2000 form that has a Hyperlink that opens an Excel 2000 worksheet located in the same network folder as the Access MDB. The Hyperlink works great. When users close the Excel File, they must choose the correct open Access form on the Windows Desktop Taskbar to return to the Access form that had the Hyperlink. Is there a way to: 1. Open the Access Form 2. Launch the Hyperlink to the Excel Workbook 3. Exit Excel, then 4. Return to the original Access form automatically - without clicking anything (such as the the TaskBar) I just need help with #4. Or, is there a better ...

Hiding Access Main Form/tables/queries/forms/etc
Thank you in advance for any and all assistance. Is there a way to hide the Main Access window with tables, queries, forms etc programmatically? Michael On Sat, 17 Jan 2004 17:17:16 -0600, "PMBragg" <pmbragg@megavision.com> wrote: >Thank you in advance for any and all assistance. > >Is there a way to hide the Main Access window with tables, queries, forms >etc programmatically? > Yes. Take a look here for some API code that will manipulate the Access window. http://www.mvps.org/access/api/api0019.htm - Jim Another way, with probably less control than the...

creating a table for accessing data via Access forms
I have to create an Access 2007 table which has data about different divisions(and departments inside it) of a company. company A has divisions of Sales, Engineering, Customer Support, Corporate Office. Sales division further has departments like marketing, pre-sales department, accounting. Engineering division has departments like Research and Development, Building group, Testing group. Customer Support has departments like Phone Support, Email support, Feedback. Corporate Office has departments like CEO office, Public Relations and so on. For each department of a division like Engineering, there are some methods to gauge performance of the department. For instance, in the Research and Development department, a criteria is set like Sample Criteria Name Sample Value Aim 1 Develop New Products State what/how will 'X' new products be done to achieve will be developed the Aim 1 this year Determine how By mid year 3 new progress will be products will be measured launched in the for reaching Aim 1 market Determine The revenue generated proposed benefit by new products will from Aim 1 be amount 'N' Aim 2 Research new markets State what/how will 'Y' new markets where our be done to achieve company products can be the Aim 2 sold will be found this year D...

Access Sub Forms
Hello All I am trying to build a couple of forms in Access 2000. Whilst I have one form which has all of the contact details in it also generates (using autonumber) a unique id for the customer. I have also created a button to open up another form which looks at a second table. I want the ID automatically populated into the form (tables are designed one to many) so that correspondence can be added. At the moment access states that data needs to be inserted into the clients table before data can be inserted into the correspondeance table. A subform has been successfully created using the but...

Forms question
Hi folks, I'm new here and am a neophyte Access 2000 user/developer. A year ago, I barely knew what Access was. I was asked by the people that pay us to begin keeping certain data about the children's crisis program I manage. After a couple of years doing this by hand on paper (Yikes!), I decided that this was ridiculous. Out of neccessity, I had to learn Access and develop a database to track clients and services. So what I know, I've learned from places like this and from the many text books I've picked up. I developed the database and entered almost 3 years of data. We av...

Unbound ADO Continuous Sub-Form Form?
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain why. I've been exploring using Access as a front end to both SQL MSDE and Oracle XE. I'm in the process of writing a class to handle the basics of the ADO connection and recordsets. The basic relationships are as follows: 1 Main form with Company data (one side of relationship) 2 Subform with Exec data (many side of relationship) 3 Subform with Recordset Selectors buttons (Next, Previous, Last, & First), current record # and total recordset count 4 Subform with Command buttons (i.e. Save, Cancel, Edit, New Record, & Delete) I've written successfully the complete form and subform (i.e. 1 & 2 above) WITHOUT the class and subforms for the recordset selectors and command buttons (i.e. 3 & 4) above. This works if I dump the Exec data into a temp Access table in the MDE file. LOTS OF CODE. I can reduce the code by using the class. I've started writing the class and have the Recordset Selectors buttons functionality working (i.e. 3 above) when I came across the ideal of form multiple instances per Allen Brown's web site at http://allenbrowne.com/ser-35.html. The PROBLEM: The Exec data in the subform which is the many side of the relationship is currently using the temp Access table in the MDE file which prevents multiple i...

Problem with ControlTip Text on form/sub-form
Hi All, If utilized as a sub-form, the ControlTip Texts of all the labels (you know...you can hover the mouse over either the control itself, or the label for that control) flickers like crazy. Hover the mouse over the control itself and it's fine. However, if I put the mouse over the short distance between 2 controls, it also will flicker. Get the mouse solidly over one or the other control and it's fine. Also, this sub-form, if used as just a form by itself, is fine. No flickering either on the label, or "between" 2 controls. Anyone know why this would be happe...

Problem with Totals on Sub Forms and Main Forms
I have an access data project (MS-SQL Svr 2000 backend and MS-Access 2003 Front End) that has a sub-form based on a query view. On the sub form I have several column's in which I have a running total on the sub-form footer. This part works fine. My problem is that the main form, on which the sub-form resides, I want to display the total from the sub-form total calculation. I have tried referencing the control on the sub form, i.e. My.Somecontrol = Forms![formname].[controlname] but this does not work. How do you make this works. Do I have to do something different because this is ...

Web resources about - Programically Create Sub-Form - attach to Parent Form - comp.databases.ms-access

Limestone Coast
... region. Home Local Search Classifieds Street Maps Photo Journal Special Home Local Search Classifieds Street Maps Photo Journal Special Programically ...

Broker-Dealers and the Fiduciary Rule
Scenario 4: The DOL enacts its fiduciary rule. How does this change the way you charge and disclose fees? Which clients are most affected? How ...

Resources last updated: 3/21/2016 2:01:01 AM