Page 1 of 1

Subform in new form

Posted: Tue Nov 29, 2016 4:12 pm
by mihmih
Hi,

i have a table (mainForm) and i want to add to some record another linked records just like in a form with subform. But i want to have this subform-table (adding, modify and delete records) in another form and open it by a button. Is maybe some simple macro to do that? I can not find any topic about it.... Thank you for any help.

Re: subform in new form

Posted: Tue Nov 29, 2016 4:47 pm
by Villeroy

Re: subform in new form

Posted: Tue Nov 29, 2016 5:01 pm
by mihmih
it is a simple open any form-macro if i understand...

i have 3 tables:

orders(id_o, orders_date)
junction_table(ID_j, ID_order, ID_product)
products (ID_prod, name, price)

and in form with table orders FOCUS is in one record. And i want to push a button and open a form, where i can add products to this order ( add data to junction_table without telling to the base any information about ID_order, just like in Mainform-subform in one FORM). Is it possible?

Re: subform in new form

Posted: Tue Nov 29, 2016 5:04 pm
by Villeroy
It is impossible if you do not understand the solution in http://www.access2base.com/access2base.html (under Actions > Open Form)

Re: subform in new form

Posted: Tue Nov 29, 2016 5:14 pm
by Villeroy
Access2Base is a macro suite written in Basic and distributed as an extension. Install the extension and make use of hundreds of wrapper functions.

Re: subform in new form

Posted: Tue Nov 29, 2016 5:15 pm
by mihmih
IS it so simple?


OpenForm(Addingproducts, , , ID_o = ID_order, , , )

Re: subform in new form

Posted: Tue Nov 29, 2016 5:45 pm
by Villeroy
I don't know. I hardly use any database macros. Of course you need to be familiar with the Basic language.

Re: subform in new form

Posted: Tue Nov 29, 2016 6:37 pm
by UnklDonald418
Perhaps this link may help you.
viewtopic.php?f=39&t=82622&p=382917&hil ... rm#p382917
Despite the misleading title for the topic, there is a macro to open (and close) a form using a button click.

Re: subform in new form

Posted: Tue Nov 29, 2016 7:26 pm
by UnklDonald418
and in form with table orders FOCUS is in one record. And i want to push a button and open a form, where i can add products to this order ( add data to junction_table without telling to the base any information about ID_order, just like in Mainform-subform in one FORM). Is it possible?
You might be able to accomplish this using a filter form.
The first form can store the MainForm ID of "one record" in the filter table which can then be read by the second form.
The Filter table would probably only need two fields. You can execute the following SQL command to create the table

Code: Select all

CREATE TABLE "FilterTable" ( "FilterID" BOOLEAN PRIMARY KEY, "MainFormID" INTEGER);
Before using it you should probably open "FilterTable" and make sure the checkbox is checked.

Re: subform in new form

Posted: Tue Nov 29, 2016 8:16 pm
by UnklDonald418
Also have you looked at this tutorial
viewtopic.php?f=100&t=56006
in particular the database Invoice_Forms_v2.odb