Hyperlink on "Report" to open corresponding "Form" (1 Viewer)

BNagel07

New member
Local time
Today, 08:28
Joined
Sep 6, 2023
Messages
4
I have developed an MS Access database for tracking our ECO's (engineering change orders).

In the screen show blow you will see the report that list all our Active ECO's. I would like to Click that object [ECO #] and have it open the form that corresponds to the selected "ECO #"

1694013693541.png


Form name that I would like to open is [04B - Engineering - Firmware ECO Form F-04B-02]

So far this is what i have.

1694013806471.png


The above Where Condition is opening a box that I manually have to type in the ECO number and then it opens the correct form.

1694013877078.png


Below is a snip of the form showing the field control source. [ECO #]
1694013958252.png



Any assistance is greatly appreciated.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:28
Joined
Oct 29, 2018
Messages
21,473
Hi. I don't use macros, so this is just a guess. Try changing the Where Condition to this and tell us what happens.
Code:
="[ECO #]='" & [ECO #] & "'"
 

BNagel07

New member
Local time
Today, 08:28
Joined
Sep 6, 2023
Messages
4
Hi. I don't use macros, so this is just a guess. Try changing the Where Condition to this and tell us what happens.
Code:
="[ECO #]='" & [ECO #] & "'"
Works as intended... Thank you for the quick response.

Could you briefly explain that condition so that I can further understand what its actually "doing"?

I'm not the greatest with these commands.
 

XPS35

Active member
Local time
Today, 14:28
Joined
Jul 19, 2022
Messages
159
Why do you want to use a report to open a form? Reports are for printing. Use a continuous form with a button to open a detail form.
 

BNagel07

New member
Local time
Today, 08:28
Joined
Sep 6, 2023
Messages
4
Why do you want to use a report to open a form? Reports are for printing. Use a continuous form with a button to open a detail form.
The report view is easier to see each active "ECO" on a single screen and allows the users to click the ECO # and open the form that show further detailed information.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:28
Joined
Oct 29, 2018
Messages
21,473
Works as intended... Thank you for the quick response.

Could you briefly explain that condition so that I can further understand what its actually "doing"?

I'm not the greatest with these commands.
Glad to hear you got it to work.

The Where Condition argument for your situation goes something like: FieldName = SomeValue

We basically constructed that argument by concatenating a string ("FieldName=") with a variable ([ECO #]).

See if this article helps any.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:28
Joined
Feb 19, 2002
Messages
43,275
Me is NEVER enclosed in square brackets and it is ONLY used in the class module of a form or report. It cannot be used in macros or queries. It refers to the form/report object in which the VBA code is running.

Object names should never include embedded spaces or special characters such as the #. The only valid characters are a-z, A-Z, 0-9 and the underscore "_". We don't even use dashes in object names. CamelCase is the common technique. Upper casing the first letter of a word helps to make the name readable without adding extra characters.

When you embed spaces and special characters you force yourself to enclose the object name with square brackets which just muddies the code and makes you type more characters than you need to.

Also, based on your form name, it looks like you are using data values to name your objects and that means you will end up with unnecessary forms.

And finally, opening a form takes only a single line of VBA so the macro is actually more complex. Now would be a good time to start learning VBA. Look up the OpenForm method. Or, just type>
DoCmd.OpenForm --- after the space, Access will help you to build the command with intellisense.
 
Last edited:

Users who are viewing this thread

Top Bottom