Default Value in Query

Sykesjas

Registered User.
Local time
Today, 02:24
Joined
Jun 14, 2010
Messages
10
I have a query where you enter an employee name which shows how many hours they have done on a project in a form. When entering a new record how do I get the employee name field to be the default value for the criteria I have based my Query search on.

For example, query search of employee name "Fred Blogs"

When adding a new record, how do I get the Employee name to a default value of Fred Blogs which I have searched. Then when I search for John Smith another time then the default value would be John Smith.

Hope this makes sense.
 
Not 100% sure where you are doing this task but it would not be by query only. You presumably would be using at least one form.

An example of what you may be doing is to search for a record, Employee and when found, create a new record of some form.

This would be like searching for a Customer and when found, Creating a New Order for that customer.

To do this, on the Search form Result Form ie the form you view when looking at the selected Record. Include a command Button that opens the form to create the new record (NewOrder, New whatever).

In the On Click Event Code you set the Link Criteria and the New Order Form will show the Customer/Employee Data - however you have the just opened form setup.
You may be able to make this happen by a wizard but if not, get your forms setup and then get assistance for the Link Code.
 
Just to further discuss your question. The query will not have a criteria. The form will do this.
The query, by itself will show all Employees, One record at a time.
When you have it opened by the Command Button it will just show the one record and be set to Add a new record.
 
Looks like the OP wants to save the value of the last search criteria to be used as the default value of a bound control for new records. Sounds like an odd request if this is the case, but if it is then just use a GLOBAL VARIABLE.

We do need more clarification though.
 

Users who are viewing this thread

Back
Top Bottom