By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Make a Report Display the Current Record in a Form

P: 2
How do I make a report display the current record open in a form?

This seems like it should be a simple issue however I am strugling to figure out what code SQL / Querry I should use to do this.

I have orders for skylights orginized by invoice. As we track production different reports need to be printed out. I want to beable to click on my report such as "Print Welding Tag" and have this insert the current Invoice number to the report.

Currently my report displays all orders that have met a set criteria such as the skylight frame has not been welded. And this gennerates a report for all orders at this stage....

currently my project is in MS Acess2000 so lets try and keep the code as simple as possible... Otherwise i will need more direction.

Thanks In Advance,
You Guys and Gals are Great!
Oct 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: 3
Here's a snippet of code that should do the job for you.

/CODE/
Dim stLinkCriteria As String
Dim stPrintOption As String


If Me![cboReportOutput] = REPORTOUTPUT_PREVIEW Then
stPrintOption = acPreview
Else
stPrintOption = acNormal
End If

stDocName = "rptSystemInformation"
stLinkCriteria = "[SysID] = " & [SysID]
DoCmd.OpenReport stDocName, stPrintOption, , stLinkCriteria

/CODE/

In this case, the form detail record to be processed would have [SysID] in the Record Source, which has the same name in the Report record source. The stLinkCriteria acts like the WHERE statement in SQL.

A look in the help file for "DoCmd.OpenReport" should give you more info.

Dave
Oct 25 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.