Prompting user for input

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have a query that is going to be a report (over employees' training and
education). Basically, I want to prompt the user to enter which individual
employee's information that he/she wants on the report.

Is the only way to do this by saying WHERE EMPLOYEE.Last_Name=[Please Enter
Last Name]?

Is there a more professional way?

How would you use the LIKE in this case so that the user does not have to
spell out the complete last name?

Thanks in advance,
David
 
Why not do this instead:

1. Create a query that pulls (and sorts) the unique employee names.
2. Put either a list or combo box onto your form that pulls the names from
the query in step 1.
3. Have your query tie to the value of the list/combo box.

This gives the user the correct list to choose from and they won't enter
something incorrectly.
 
Hello

I have a query that is going to be a report (over employees' training and
education). Basically, I want to prompt the user to enter which individual
employee's information that he/she wants on the report.

Is the only way to do this by saying WHERE EMPLOYEE.Last_Name=[Please Enter
Last Name]?

Is there a more professional way?

You may want to consider using a Combo Box on a Form as a criterion.
Your employee table should have a unique EmployeeID; names are NOT
unique (I once worked with Dr. Lawrence David Wise and his colleague
Dr. Lawrence David Wise).

First, create a small unbound Form; let's call it frmCrit. Put a Combo
Box, cboFindEmployee, on the form; its Rowsource would be something
like

SELECT EmployeeID, LastName & ", " & FirstName, <other identifying
info> FROM Employees Order By LastName, FirstName;

The combo should be unbound (nothing in the Control Source), and have
1 in the Bound Column property.

Create a Query based on your table or tables, containing the
information needed for the report, with a criterion on the EmployeeID
of

=Forms!frmCrit!cboFindEmployee

and base your Report on this Query.

If you then put a command button on frmCrit to open the Report, the
user will never need to see the database window at all - just have
frmCrit open from the switchboard (or have it be the Startup form if
this is all these users need to do). They open the form, select an
employee, click the button, and pick up the report.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Thank you.
That works great EXCEPT that for some reason the Combo box only shows the
EmployeeID (a number) and not the concatenated name. So the user needs to
know the individual's EmployeeID that he or she is trying to look up.


(I would prefer them to see the corresponding name, so that it can be done
directly from the switchboard. Otherwise I will have to have them look at
the Main Employee Form to see who has what employee number then click on the
Open Form button, enter the EmployeeID, and click Preview Report.)

Thank you both for your time,
David

John Vinson said:
Hello

I have a query that is going to be a report (over employees' training and
education). Basically, I want to prompt the user to enter which individual
employee's information that he/she wants on the report.

Is the only way to do this by saying WHERE EMPLOYEE.Last_Name=[Please Enter
Last Name]?

Is there a more professional way?

You may want to consider using a Combo Box on a Form as a criterion.
Your employee table should have a unique EmployeeID; names are NOT
unique (I once worked with Dr. Lawrence David Wise and his colleague
Dr. Lawrence David Wise).

First, create a small unbound Form; let's call it frmCrit. Put a Combo
Box, cboFindEmployee, on the form; its Rowsource would be something
like

SELECT EmployeeID, LastName & ", " & FirstName, <other identifying
info> FROM Employees Order By LastName, FirstName;

The combo should be unbound (nothing in the Control Source), and have
1 in the Bound Column property.

Create a Query based on your table or tables, containing the
information needed for the report, with a criterion on the EmployeeID
of

=Forms!frmCrit!cboFindEmployee

and base your Report on this Query.

If you then put a command button on frmCrit to open the Report, the
user will never need to see the database window at all - just have
frmCrit open from the switchboard (or have it be the Startup form if
this is all these users need to do). They open the form, select an
employee, click the button, and pick up the report.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Thank you.
That works great EXCEPT that for some reason the Combo box only shows the
EmployeeID (a number) and not the concatenated name. So the user needs to
know the individual's EmployeeID that he or she is trying to look up.

Set the ColumnWidths property of the Combo box so that the width of
the EmployeeID field is zero. For example, if the RowSource query for
the combo is

SELECT EmployeeID, LastName & ", " & FirstName, Department
FROM Employees
WHERE ActiveEmployee = True
ORDER BY LastName, FirstName;

you could set the ColumnWidths property of the combo to

0;1.25;.75

to show the computer the meaningless ID, and show the user the name
and department; both will end up happier.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Hi John,

For some reason that did not work, so I just made the query that we had in
the Row Source and then based the Combo box off of that. For some reason, by
doing it that way, now it all shows up.

Thanks for your help.

Sincerely,
David
 
Back
Top