make a query dependent on a variable on a form or report

J

JR

I am trying to find a way to take the following query:

SELECT Timeslip.EmployeeID, Timeslip.Day, Timeslip.TaskName, Timeslip.Hours,
Timeslip.TaskType, Timeslip.Comments
FROM Timeslip
WHERE (((Timeslip.EmployeeID)="4.0363"));

and

1) make the Where statement dependent on a control on either a form or report

2) get the result into a report in the least number of clicks for the user.

Thanks.

JR
 
N

NuBie via AccessMonster.com

Start here, customize as needed:

1) make the Where statement dependent on a control on either a form or report


SELECT Timeslip.EmployeeID, Timeslip.Day, Timeslip.TaskName, Timeslip.Hours,
Timeslip.TaskType, Timeslip.Comments
FROM Timeslip
WHERE (((Timeslip.EmployeeID)=Form!TxtEmployeeID));

2) get the result into a report in the least number of clicks for the user.

Put a listbox control in your form with Employee Id. On click event of the
list box open the form and set the Record Source to SQL on 1).
 
N

NuBie via AccessMonster.com

Start here, customize as needed:

1) make the Where statement dependent on a control on either a form or report


SELECT Timeslip.EmployeeID, Timeslip.Day, Timeslip.TaskName, Timeslip.Hours,
Timeslip.TaskType, Timeslip.Comments
FROM Timeslip
WHERE (((Timeslip.EmployeeID)=Form!TxtEmployeeID));

2) get the result into a report in the least number of clicks for the user.

Put a listbox control in your form with Employee Id. On click event of the
list box open the form and set the Record Source to SQL on 1).
 
J

JR

Thanks!

It almost works.

the variable gets passed to the report, but it never gets acted on. I went
to properties and there under filter is the value that was entered on a form.
Used the form to change the values a couple of times ... each time the value
changed. But the report does nothing with it.
Report is set up to execute the filter on opening.

Trying to make it happen!

JR
 
N

NuBie via AccessMonster.com

Did you set the Record Source of the report to :

SELECT Timeslip.EmployeeID, Timeslip.Day, Timeslip.TaskName, Timeslip.Hours,
Timeslip.TaskType, Timeslip.Comments
FROM Timeslip
WHERE (((Timeslip.EmployeeID)=[Forms]![YourFormNameHere]![TxtEmployeeID]));

Thanks!

It almost works.

the variable gets passed to the report, but it never gets acted on. I went
to properties and there under filter is the value that was entered on a form.
Used the form to change the values a couple of times ... each time the value
changed. But the report does nothing with it.
Report is set up to execute the filter on opening.

Trying to make it happen!

JR
Start here, customize as needed:
[quoted text clipped - 26 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top