Linking form and continuous subform

nectar

New member
Local time
Today, 20:28
Joined
Sep 16, 2003
Messages
8
Hello,

In an Offers DB, I have a form with two fields BeginDate and EndDate.

When clicking on a button, it opens a continous form with a DoCmd.OpenForm and a criteria based on the 2 dates (i.e. it shows all the offers that were created between the two dates).

What I would like to do is to open a "simple" form where the previous continous form is embedded as a subform.

How do I have to link the new form with the subform?? In particular, what do I have to enter in Link Child an Link Master fields? The 2 dates do not have to be saved in any table.

In such a way I could have the same behaviour than an Iframe in a browser, showing at the top of the form the two dates representing the selection.

Many thanks in advance
 
The usual syntax of the openform method will not work in this manner but a little cheat will, but it depeds on the recordsource of the subform.

In general, you can recycle the existing code but rather that passing the strCriteria as a criteria, pass it as openags to the form you are opening (cannot remember the exact syntax at the minute) I think it would be.

docmd.OpenForm FormName,,,,,,strCriteria
create a hidden textbox on the new simple form.

On the Form_Load event of this new main form,

Code:
Sub Form_Load()
with me
if .openargs then
.hiddentextfield = .openargs
end if
end with

on the Form_Open() of the embedded subform

Code:
Sub Form_Open()
with me
if not isnull(.parent.hiddentextfield)
.filter=.parent.hiddentextfield
.filteron = true
else
.filteron = false
end if
end with

I can not check this at the moment so you are the guinea pig I'm afraid;)
 
Thanks Fizzio, will try it ASAP!
 

Users who are viewing this thread

Back
Top Bottom