Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sub subform "enter paramter value"

Status
Not open for further replies.

gusgormen

IS-IT--Management
Apr 8, 2008
1
GB
hi

i have subform2 within subform1, and subform1 within formhead. when i open subform 2, everyhting works fine. when i open formheader, i get two pop up boxes with enterparamter vale". these value requirements are from the qry criteria on subform2 (whichis based forms!frm_subform1!fieldname1).

what i am trying to achieve is to show on subform1 prices generated by criteria and subformed to a lookup table. which works prefectly.
on the header i want to show customer details, and use subform to add quotes for these customers. which works perfeectly if i dont have subform 2 within subform 1.


any ideas much appreciated.

thanks

 
Sounds odd - are the criteria in the recordsource?

If so, can you open a query with the same recordsource?

One other option is to set the subform recordsource manually, usually oncurrent or some other change. Use either recordsource="" or apply a filter.

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
Isn't the problem caused by the link child/master field property of subform2?

Pampers [afro]
Keeping it simple can be complicated
 
How are ya gusgormen . . .
[blue]i get two pop up boxes with enterparamter vale". these value requirements are from the qry criteria on subform2 ([purple]which is based forms!frm_subform1!fieldname1[/purple]).[/blue]
[blue]Be aware:[/blue] A form with subforms opens from the inner most subform(s) out to the mainform! In your case this means:
[blue]1) subForm2 opens first
2) subform1 opens next
3) MainForm opens last[/blue]
If your following this, when subform2 opens, subform1 is not open yet and [blue]subform1!fieldname1[/blue] is not available! . . . [purple]Can you see it! . . .[/purple]

To solve this you need to perform a technique called [blue]Late Binding[/blue]. Meaning . . . the [blue]RecordSource[/blue] of subform1 & subform2 are set proper by the mainform, after the mainform opens. Direct manipulation is dependent on the [blue]RecordSources[/blue] being dependent on Tables, Queries or SQL's. As an example, the following assumes the [blue]RecordSources[/blue] of the subforms are dependent on SQL's (you alter approriately where table/query names are involved). You start with no [blue]recordsource[/blue] for subform1 & subform2 [blue]in form design view[/blue] and proceed as follows (the [purple]OnLoad[/purple] event of the mainform is a good place for the code):
Code:
[blue]   Dim sfrm1 As Form, sfrm2 As Form, SQL As String
   
   Set sfrm1 = [[purple][b][i]subForm1Name1[/i][/b][/purple]].Form
   Set sfrm2 = sfrm1![[purple][b][i]subFormName2[/i][/b][/purple]].Form
   
   [green]'Late Bind subForm1.
   '[i]Subform1!fieldname1[/i] is now available for subForm2![/green]
   SQL = "[purple][b][i]SQL for subform1[/i][/b][/purple]"
   sfrm1.RecordSource = SQL
   
   [green]'Late Bind subForm2[/green]
   SQL = "[purple][b][i]SQL for subform2[/i][/b][/purple]"
   sfrm2.RecordSource = SQL
   
   Set sfrm2 = Nothing
   Set sfrm1 = Nothing[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Nice TheAceman1,
missed that one: forms!frm_subform1!fieldname1

Pampers [afro]
Keeping it simple can be complicated
 
Thank you [blue]Pampers[/blue]. It almost got by me! . . . [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top