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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hyperlink from subform1 to open mainform2

Status
Not open for further replies.

CitoT

Technical User
Jul 20, 2005
1
US
1st Thank you for looking at my issue. I have two forms each with subforms. mainform1 contains subform1 and mainform2 contains subform2. Mainform1 uses combobox of distinct "source code" records to list matching subform1 records. child and master form linked by source code.

subform1 contains key field product_id and runs macro "on click" to attempt to open mainform2 on matching produc_id. This works fine when I only open subform1 and click product_id to open mainform2. However, when I open mainform1 and click on product_id from subform1 it keeps asking me for the product_id. Mainform1 source records based on query1, subform1 source table is table1. Mainform2 and subform2 source records are also from table1.

The macro, when clicking product_id in subform1 opens mainform2 per condition [Table1]![product_id]=[Forms]![SubForm1]![product_id]. This works if I only open subform1 and click product_id but if I open mainform1 and click on product_id in subform1 then the marcro's condition fails and I am prompted to enter product_id.

Cant seem to figure the correct condition for the macro. Please offer any suggestions and if you need more information or screen shots please let me know. Thank you!
 
How are ya CitoT . . .

Are you talking a macro or VBA?

In any case ... the [blue]form reference[/blue] for [blue]product_id[/blue] from the subform open independantly is not the same as when its an actual subform! Open independantly its a mainform, as a part of opening the mainform its an actual subform. Try changing the reference to:
Code:
[blue][Forms]![[purple][b]MainFormName[/b][/purple]]![SubFormName][purple][b].Form[/b][/purple]![product_id][/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top