Combo Box Trouble

  • Thread starter Thread starter djohnson
  • Start date Start date
D

djohnson

Guest
Yep I'm new and green to Access. This should be an easy one but I have yet to get it fixed....

I have an employee table and would like to use a combo box to select the employee by a given 4 digit employee ID. Right now it simply records the number I select, but what I want is for it to pull up all the fields (columns) related to that employee number ~ which will be the info for the employee.

In other words, I'd like to use a combo box to do the record selection function at the bottom of the window....only via the specific employees in the combo box. Thanks for your time and help! :D
 
djohnson said:
In other words, I'd like to use a combo box to do the record selection function at the bottom of the window....only via the specific employees in the combo box. Thanks for your time and help! :D


Hey DJ,

Follow this link and this should help you accomplish what your trying to do.

http://www.mvps.org/access/forms/frm0005.htm

HTH,
Shane
 
Thanks Shane

Shane, I figured it out I used the

=[ComboBoxName].Column(1)
=[ComboBoxName].Column(2)
etc.

for each field in the form (from design view) that I wanted the combo box to update. The column numbers (Column(1) etc) are selected from the table identified in the row source property of the combo box.

Now the only snafu I'm having is how to get the OLE picture to update in the same manner...because it won't and

If I figure this out I'll post what I did.

If anyone knows, please let me know!

And Shane, as we speak, the Horns are #1 :) peace!
 
DJohnson,

I'm not sure that the link ShaneMan posted is actually what you are asking for. If it is, sorry for posting and possibly confusing things.

here is how I would takle your problem.

If your employees table does not have a primary key, go back to it and set one now. Add a field called something like EmployeeID and make it an 'autonumber' field.

In the target table, make the field you want to display the employee data in. This will be the foreign key and should be the same name as the primary key in your employees table and set to number type.

Go to the tools/relationships window and if both tables are not showing, right click and select show tables then select the employees table and the target table. Click and drag EmployeeID from the employees table to the target table EmployeeID. Select the appropriate referential integrity levels for your application; probably just check all three boxes for now.

Create a form based on the table you want to put the information into. The form wizard should assist you in this. You should end up with a form and a number of text boxes, one for each field in target table.

In design view, right click on the text box that you want the employee data to go into and select 'Change to Combo" box.

On the data tab of the properties box click in the row source and then click on the three dots to the right hand side. This should open up the query grid for you. Right click and select add tables and pick the 'employees table.

In the employees table showing in the top half of the design grid, double click or drag and drop the primary key field of the employees table. This Will move it down to the grid part in column 1. Now click on the other fields in the employees table to show what other data you want to see such as name, telephone number or whatever, then close this window.

Back in the properties box, go to the 'All' tab and look for 'Bound Column' which should be set to 1. This links your target table to the employees table. The only information stored in the target table is the number from the primary key of the employees table.

Next find the 'Column Count' and enter the number of columns you created in the sql design grid.

Next, set the column widths. This would typically be something like 0cm for the primary key field (you don't want to see this a sit is a meaningless number as far as DB users are concerned) and then widths appropriate to the columns you want to view. It should look something like this (for metric viewers!) 0cm;4cm;2cm or be inches for the old fashioned or North Americans.

Finlay, you can set the number of rows to display in your combo box. Play around with this to find what works best for your needs.

Save the form and open it. After that rather long winded process, you should have a combo box which you can click on the down arrow to see all employees in the employees table and link them to whatever data is in your target table. :)

All this is recited from memory so I may have missed out something or got muddled but this isn't as difficult as it might sound, just a bit convoluted. If you have any problems, post back and I will attempt to sort you out.

And welcome to the forum. If you get into Access, it is a fascinating place. :D
 
djohnson said:
Shane, I figured it out I used the

=[ComboBoxName].Column(1)
=[ComboBoxName].Column(2)
etc.

for each field in the form (from design view) that I wanted the combo box to update. The column numbers (Column(1) etc) are selected from the table identified in the row source property of the combo box.

Now the only snafu I'm having is how to get the OLE picture to update in the same manner...because it won't and

If I figure this out I'll post what I did.

If anyone knows, please let me know!

And Shane, as we speak, the Horns are #1 :) peace!

Sorry about that DJ. I thought you were wanting to use the cboBox to go to a specific record. On the OLE thing. I know the question has been asked so a good search should turn up something for ya. Post back if not cause there's really good folks, here, who can help.

As far as the Horns thing....well I guess ya'll getting it every 35 years is something I could live with.:eek:
 
Last edited:

Users who are viewing this thread

Back
Top Bottom