General discussion

Locked

Why can't I have 1+ working combo boxes

By jmiller ·
I am not an access guru but I feel I am an intermediate but I am trying to setup a Information Systems Service Request Form. I have all my employees data in a seperate table and a blank table waiting to be filling up with requests. On the form I made I have various user data combo boxes but The only one that works is the combo box that is directed to the 1st colomn in the table I have all the data in. And everyother combo box uses that same colomn, EVEN THOUGH it is directed to go to the others that it is specified to. This has been driving me crazy for days and I can't seem to find the answer, Please help me out.

thanks

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Why can't I have 1+ working combo boxes

by rw2000 In reply to Why can't I have 1+ worki ...

In Access 97, when you base a combo box on a second table (the Row Source), the Bound Column tells which field number (1 for the first field, 2 for 2nd, ...) in the Row Source to get the data from. The Column Count tells how many fields to show from Row Source, starting with its first field. If you have Column Count as 1, it only shows the first field from the Row Source -- regardless of which Bound Column you have selected.
You might be better off using a simple SQL code for your Row Source. Set the Bound Column to 1, and try using something like: SELECT DISTINCT fieldname FROM employeetable ORDER BY fieldname;
Or: SELECT DISTINCT fieldname FROM employeetable WHERE (employeetable.[fieldname2]=[aFilledinFieldOnThisForm]);

Collapse -

Why can't I have 1+ working combo boxes

by jmiller In reply to Why can't I have 1+ worki ...

Poster rated this answer

Collapse -

Why can't I have 1+ working combo boxes

by Bob Sellman In reply to Why can't I have 1+ worki ...

I'm not sure what you are doing with the additional combo boxes. If you are trying to get additional information from the employees table (such as account number, address, etc.), you can do that with the first combo box as follows:

Use the method described in the previous response, but include multiple columns in the SQL statement. Let's say you want name, number, and address and the combo box is named cboName:

If the SQL statement is:
SELECT name, number, address FROM Employees ORDER BY name

you would then set cboName's ColumnCount property to 3 fields. You could set the display widths to only display the name, for example, or all three if needed. Set the bound column property to 1 (for the name).

cboName will display theselected name.

If you have two other controls named txtAccount and txtAddress in the record you would set their values (using the AfterUpdate property of cboName) with the following code:

me.txtAccount = me.cboName.Column(1)
me.txtAddress = me.cboName.Column(2)

The trick with this is to know that the first column (name) is numbered Column(0) by Access, even though you set the BoundColumn property of cboName to 1 (because there it's considered column 1...ask Bill Gates).

On the other hand...if the other combo boxes in your current setup depend upon the value in the first combo box, you should put the following code in the AfterUpdate property of the working combo box:
me.ComboBox2.Requery
(repeat for all of your other combo boxes...you may have to use Recalc instead of Requery)

You may, in fact, need to do the same for combobox3 after combobox2 has been updated, and so on for the remaining combo boxes.

Collapse -

Why can't I have 1+ working combo boxes

by Bob Sellman In reply to Why can't I have 1+ worki ...

I forgot to mention that if you use the method I described using the Column(x) value, you would set the property of Locked to True and TabStop to No for the controls txtAccount and txtAddress, since the user should not be entering that data (unless you want to give the user that ability).

Collapse -

Why can't I have 1+ working combo boxes

by jmiller In reply to Why can't I have 1+ worki ...

Poster rated this answer

Collapse -

Why can't I have 1+ working combo boxes

by donq In reply to Why can't I have 1+ worki ...

When I run into a problem like that I generally open query design and construct a query that delivers exactly what I want. Then I switch to SQL View and copy the query [Ctl]+C

Close the query, open the form and double click on the appropriate combo box to open its properties sheet and click on the "Data" tab. Do a paste [Ctl]+V into the Row Source property and repeat the process for each combo box you need. Be sure and set Limit to List to Yes if necessary.

Then you might validate yourControl Source (same tab) is set to the field you want to populate.

Keeping your little queries seperate will sake you a lit of grief, and remember it's database programming, not Access that's driving you crazy! Keep going - you'll just get better!

Collapse -

Why can't I have 1+ working combo boxes

by jmiller In reply to Why can't I have 1+ worki ...

Thanks! This helped alot.

Collapse -

Why can't I have 1+ working combo boxes

by jmiller In reply to Why can't I have 1+ worki ...

This question was closed by the author

Back to Web Development Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums