Put data from report into a form (1 Viewer)

ariansman

Registered User.
Local time
Today, 04:59
Joined
Apr 3, 2012
Messages
157
I have a report of Employee’s jobs, named EmployeeReport. I would like to open a form named “Form1” when I click on an EmployeeID on the EmployeeReport. Form1 is not set on a table or a query. This form has some unbound controls. One of the controls is named “Employees”.

So far, I know I should set a macro command, onclick “EmployeeID”, to openform and formname: Form1, view: normal. This command opens Form1. But the unbound control “Employees” is left blank.

How can I make the macro so that when I click on the “EmployeeID” of the EmployeeReport , Form1 is opened, and the “EmployeeID” is shown in the “Employees” control of Form1?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:59
Joined
May 7, 2009
Messages
19,169
add Where Condition when you open the Form:

Where Condition = ="[EmployeeID] = " & [EmployeeID]
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:59
Joined
Sep 21, 2011
Messages
14,038
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:59
Joined
Feb 28, 2001
Messages
26,996
This is a bit confusing, because if you made the form bound to a table of employees, there is a simple operation involving a combo box created through the Combo Box wizard that would allow you to select an employee and immediately navigate to that record. The part that is confusing is that if you have a report already, that implies that you have a table - and that means the combo box to select & navigate should work. So my next question is, why did you take this approach when Access would have done a lot of this work for you automatically?
 

GPGeorge

Grover Park George
Local time
Today, 04:59
Joined
Nov 25, 2004
Messages
1,775
I have a report of Employee’s jobs, named EmployeeReport. I would like to open a form named “Form1” when I click on an EmployeeID on the EmployeeReport. Form1 is not set on a table or a query. This form has some unbound controls. One of the controls is named “Employees”.

So far, I know I should set a macro command, onclick “EmployeeID”, to openform and formname: Form1, view: normal. This command opens Form1. But the unbound control “Employees” is left blank.

How can I make the macro so that when I click on the “EmployeeID” of the EmployeeReport , Form1 is opened, and the “EmployeeID” is shown in the “Employees” control of Form1?
This sort of goes against the current in relational database design, doesn't it?

Forms are designed for tasks involving managing data: finding it, editing it, adding it, deleting it, manipulating it and so on.

Reports, on the other hand, are usually deployed at the END of that process, where you simply need to present a static display of some or all of the data.

You want to start with the end result and go back to the beginning, i.e. from the report back to the form.

Maybe, there's more to the workflow than is included in your question, though. Or is it simply a matter of terminology? Sometimes people call a form a "Report" because it's a summary or list form that presents an uneditable list of items in a style similar to the report.
 

ariansman

Registered User.
Local time
Today, 04:59
Joined
Apr 3, 2012
Messages
157
This is a bit confusing, because if you made the form bound to a table of employees, there is a simple operation involving a combo box created through the Combo Box wizard that would allow you to select an employee and immediately navigate to that record. The part that is confusing is that if you have a report already, that implies that you have a table - and that means the combo box to select & navigate should work. So my next question is, why did you take this approach when Access would have done a lot of this work for you automatically?
Yeah. You are right. I could make it bond to a Combobox list of EmployeeID. But I still will have to select the EmployeeID from the list manually.
I want it to load the EmployeeID, compatible with the EmployeeID onclick on the report.
 

ariansman

Registered User.
Local time
Today, 04:59
Joined
Apr 3, 2012
Messages
157
This sort of goes against the current in relational database design, doesn't it?

Forms are designed for tasks involving managing data: finding it, editing it, adding it, deleting it, manipulating it and so on.

Reports, on the other hand, are usually deployed at the END of that process, where you simply need to present a static display of some or all of the data.

You want to start with the end result and go back to the beginning, i.e. from the report back to the form.

Maybe, there's more to the workflow than is included in your question, though. Or is it simply a matter of terminology? Sometimes people call a form a "Report" because it's a summary or list form that presents an uneditable list of items in a style similar to the report.
Yeah. the logic seems to be compromised here. Let's look at it for the sake of feasibility.
Can I put the EmployeeID of the report on which I just clicked, into a control in the form? I need to be on the ONCLICK module.
thank you
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:59
Joined
Sep 21, 2011
Messages
14,038
Yeah. the logic seems to be compromised here. Let's look at it for the sake of feasibility.
Can I put the EmployeeID of the report on which I just clicked, into a control in the form? I need to be on the ONCLICK module.
thank you
Yes
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:59
Joined
May 7, 2009
Messages
19,169
add code the Form1 Load Event:
Code:
Private Sub Form_Load()
If SysCmd(acSysCmdGetObjectState, acReport, "EmployeeReport") <> 0 Then
    Me.Employees = Reports!EmployeeReport!EmployeeID
End If
End Sub
 

ariansman

Registered User.
Local time
Today, 04:59
Joined
Apr 3, 2012
Messages
157

Users who are viewing this thread

Top Bottom