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!

Creating report from one lookup entry

Status
Not open for further replies.

Fabioedl

Programmer
Feb 18, 2004
6
US
I need to create a report of a database. This report will be related to an entry of one field (it is a lookup field). Everything in this report will be entries related to that field.

i.e.:

Product: XXXXX

Date Price
XX/XX XX.XX
XX/XX XX.XX
. .
. .
. .
XX/XX XX.XX

Does anyone know how would I do it? I need to be able to select what product I want to create this report.

Thanks a lot,

Fabioedl
 
I would create a form "frmRptSlct" with a combo box "cboProductID". Then add a button that opens your report. The following code makes assumptions regarding your report and field names and field type:
Code:
Dim strWhere as String
strWhere = "1 = 1 "
If Not IsNull(Me.cboProductID) Then
   strWhere = strWhere & " AND [ProductID] = " & Me.cboProductID
End if
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere




Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
dhookom,


I suppose you have answered the question they MEANT, but that is really instantiating an existing report, not CREATING one?




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
After reading the initial post, I was maybe aiming at the wrong target. I usually assume that at least some sort of report has been created.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
I think you answered what they MEANT. It is entirely semantic mis-use of the "Technical" term -and I presume it is on the part of Fabioedl . I only mention it as it is possible that they really meant to create a report.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
I would develop a form containing a combo box that allows the user to select the ProductID. Once that is done, you should develop a query that uses the value in the combo box as its criteria. Place a button on the form that opens the query. After verifying that the query fetches the correct data, remove the button from the form. Develop a report that uses the query as its record source. Place a button on the form that opens the report.

Frank kegley
fkegley@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top