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

Problem with Form and Subform

Status
Not open for further replies.

ajorge

MIS
Mar 20, 2002
18
0
0
US
I have a subform called "HOME Building Subfrom" in this form I have a command button that prints a report based on the current record and when I Veiw the form by itself it works perfect. When the form is open with the main form the print report function doesn't work.

The code I used on the on click is:

Docmd.openreport "HOME Buildings",acprint,,"[HOME Buildings]![BuildingNumber] = [Forms]![HOME Building subform]![BuildingNumber]"



Alexander Jorge
City of Miami
Information System Analyst
[pc]
 
Hi Alexander,

Try creating your criteria as a string first:

Dim ReportCriteria

ReportCriteria = "[Forms]![HOME Building subform]![BuildingNumber] = " & Me![BuildingNumber]

Docmd.openreport "HOME Buildings", acprint, , ReportCriteria


HTH,

jbehrne

If at first you don't succeed, call in an airstrike. - Murphy's Laws of Combat Operations
 
If joehrne's suggestion doesn't work you might try:

Docmd.openreport "HOME Buildings",acprint,,"[HOME Buildings]![BuildingNumber] = [Forms]![MAIN FORM]![HOME Building subform]![BuildingNumber]"


Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top