Solved: Using an Unbound Combo Box to get data

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

SlowHnds

Thread Starter
Joined
Mar 11, 2010
Messages
212
I have a fairly simple database as part of it

Employee_TBL
Employid_fld
FirstName_fld
LastName_fld

I have an asset table which contains all the assests assigned to an employee

AssetListing_TBL
AssetId_fld (autonumber Key)
AssetDescription_fld
AssetMake_fld
AssetModel_fld
AssetSerial_fld
AssetValue_fld
EmployeeId_fld (lookup from Employee_TBL

I want to be able run a query using a form with a combo box unbound. I can get the form to display the employee id. But when I run the query it still asks me for the EmployeeId. How to I get the query to use the information in the combo box?? I can make the query run by filling the criteria manually but I'd rather have better control over data integerity by using a form.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
If you have the form based on the query to find employees, remove any Parameters or Criteria from the query so that it no longer asks for the EmployeeID.
Delete the current combo and use the Combo wizard to add a new one, but this time when it asks the first question, do not select the default "I want the combo to look up the values in a table or query", instead choose the 3rd option "Find a Record on my Form based on the value I selected in the combo".

That will create a "Find" combo which will allow to go to any record on the form.
 

SlowHnds

Thread Starter
Joined
Mar 11, 2010
Messages
212
The form is an unrelated object or it could be related to the query.

There are only two options (radio button selections) available.

I want the combo box to lookup values in a table or query

or

I will type in the values that I want.

I want the user to select from the drop down list in the combo box, can either be a query based on or from the employeeid_TBL

Then they press a button to run the query which displays a datasheet of all the assets under the control of an employee.

The strange thing is that I had this working at one point but it has since vanished.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
OK, what is in the Criteria Rows of the Query that you want to use to display the datasheet?

I still think that the version that I suggested, or a form filter is more user friendly.
 

SlowHnds

Thread Starter
Joined
Mar 11, 2010
Messages
212
For some reason I can't do what you are suggesting. Not sure why, probably once again my own inexperience and not knowing how to do certain things.

In attempting your suggestions I saw something that made my mind go click. So what I did was this.

I created a new form Named it EmployId with the combo box on it which was a lookup to a query Employee_TBL. All the query contains is the EmployId_fld, FirstName_fld, and LastName_fld. I named the combo box employeeid.

I put two buttons on the form. Close the form and run the query.

In the query I set the parameter to [Forms]![EmployId].[EmployeeId]

When I enter the combo box it drops down the list of employees I select the employee I want press the Run Query and I get an Editable Data sheet of all assets assigned to a particular employee.

I can't think of why this wasn't working before. Minor spelling error or ???
Anyhow this is working and I am going to continue to try your suggestion to see if I can make it work.

Again thanks for your help.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Well done.
To get my suggestion to work you have to have the Form based on the Editable Data Query without the Criteria, but you could also try using it with the Criteria as it is now and in the After Update event of the Combo enter
Me.requery.

Which will requery the Form with the selected EmployeeID.
It just saves opening and closing the query or another form.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top