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

Open Form from Column Report

Status
Not open for further replies.

ImStevenB

IS-IT--Management
Apr 6, 2002
66
US
I have a form that I created that shows all related records in a column report. The report shows a list of Spec Numbers for a given part number.

Here are the column titles:

Spec No Dwg Number Revision Assembly
Record1
Record2

What I want to do is click on the Spec Number, or a button by it, and have a form open for that Spec number on the row I clicked.

I have tried using the Open Report command in a Macro where [Spec No] = [Forms]![<report name>]![Spec No]

All I get is a blank form, no fields, no information.

Am I missing a line in the macro? The only line is Open Report.

Thank you in advance.


Im Steven B
 
You can do this with a button or from the control (by double clicking or the like).
For a button, put the following code in the on click event.


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = &quot;NameOfFormToOpen&quot;

stLinkCriteria = &quot;[SpecNo]=&quot; & Me![SpecNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria

As a side note, Forms and Reports are different objects in MS Access. Forms are useful for viewing, editing, and entering data. Reports are used for printing data. Be careful when working with macros and vba code and make sure you are referencing the correct object!

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top