473,387 Members | 1,619 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,387 software developers and data experts.

Inserting Subform by using the Command Button

27
Hi ,
Could you please advise if there is a chance of adding a particular subform to main form by clicking the command button.
Is there applicable VBA Code for that???

Main Form: Quotation1
Subform: Optional Quotation Subform

Many thanks,
Megdzia
Sep 11 '08 #1
3 1556
Stewart Ross
2,545 Expert Mod 2GB
Hi Megdzia. It is really not practicable to do what you suggest, and I cannot really think of a situation where it might make sense to do so. It is more normal to be able to assign a different recordsource to the same subform if need be.

What you can do, if you really need to have choice over the subform itself rather than its recordsource, is to design a main form with two subforms overlaid one on the other and use code to make one or the other visible to users under program control. It would achieve the same effect without trying to change the form design the way you suggest.

-Stewart
Sep 11 '08 #2
MEGDZIA
27
Thank you for your advice Stewart.
The main form is used in my company as a Quotation Form.
It has got one subform Quotation Subform to state Item, Description and Price. But some quotes need a optional table(in this case it would be second subform ). I cannot think of any other way of doing it. :(
Sep 11 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
It is quite possible to include a command button on your subform to open a pop-up form when needed, to fill in other details such as optional additional stuff.

The design of the pop-up form would depend on the application, of course, but in effect instead of having two subforms in the one main form you pop up a third form on demand which is filtered by the relevant subform key fields so that it applies to the current record only.

I use continuous view subforms so I can add command buttons to pop up subsidiary data (which you can't do in datasheet view).

I attach a screenshot from an (old) application of mine which shows what I mean. Its a budget database which records totals for purchase orders issued. Each order can have many invoices attached, which are recorded through a pop-up form. Also, orders can have additional details, again entered through another pop-up form.

-Stewart
Attached Images
File Type: jpg ScreenHunter_57.jpg (16.1 KB, 129 views)
Sep 11 '08 #4

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

Similar topics

15
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that...
2
by: Andante.in.Blue | last post by:
Hi everyone! I was wondering if there is a away to use Access 97's build in filter-by-form function but restrict its effect to just the subform. I have a parent form that shows the major...
3
by: Uwe Range | last post by:
Hi to all, I am displaying a list of records in a subform which is embedded in a popup main form (in order to ensure that users close the form when leaving it). It seems to be impossible to...
6
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but...
1
by: gavo | last post by:
Hello everyone! Using A2K i have a form(a) with a subform(b) and within the subform there is a continuous subform(c). in the subform (b) there is a command button used to call a public...
2
by: Smartin | last post by:
Using Access 97 I am trying to create a form that allows for user entry of search terms and displays a table of results. I thought I could accomplish this using a subform but it isn't quite...
3
by: ghat12 | last post by:
Hi, I have created a form containing 5 textfields/combo boxes and a command button to conduct searches for matching records. My results are currently displayed as a separate datasheet which is...
14
by: Kurt | last post by:
I have an unbound main form with an unbound subform. frmProjects fsubProjectList Using combo boxes, the user can select several search criteria on frmProjects and then click a command button....
1
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.