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 Westi 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 List

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
 
Hi ImStevenB

You mention forms and reports but if you want to open one form from another I would use the DblClick event for the field. I use Double click rather than on click to stop unintentional clicks triggering the event.

code would be

stDocName = &quot;name_of_your_form_to_open&quot;
DoCmd.OpenForm stDocName,,

(see help for criteria)

In the query this form is based on set the criteria for spec no:

=Forms![previous_form]![Spec No]

Hope this helps
 
YOu mixed Form and Report several times. Subject says &quot;FORM&quot; but you use &quot;REPORT&quot; three times in the body. Assuming you want to open a report based on a value in the form, use code behind a button:
Dim strReport as String
Dim strWhere as String
strReport = &quot;rptMyReport&quot;
strWhere = &quot;[Spec No] = &quot; & Me.txtSpecNo
DoCmd.OpenReport strReport, acViewPreview,, strWhere
This assumes Spec No is a number. If not, use:
strWhere = &quot;[Spec No] = &quot;&quot;&quot; & Me.txtSpecNo & &quot;&quot;&quot;&quot;


Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top