Web Development
16 replies
by peleg
A combo box is a way to lookup a row by using one of the columns as a index. When you select the row, the other columns in the Row Source are available. You refer to the columns as me!cboCombo.column(x) where 0 is what shows in the combo, and, moving from left to right, 1, 2, 3... reference the rest of the columns in the Row Source. So, you can only lookup data in a combo by one and only one index. But when you close the combo, you can display anything in the Row Source in another text box by using "=cboCombo.Column(x)" as the Text Box's Control Source. Now, if you want to search by either of two columns, you have to have two combo boxes. These when you select from one of them, you can force the other to display by setting it's value in the After Update event handler:
me!cboCombo1 = me!cboCombo2.column(1)
and in the other combo:
me!cboCombo2 = me!cboCombo1.colummn(1)
by pstempien
This seems to be an answer to the question howevver I am sure there are easier ways of getting this accomplished. This is not a very unsusual request or am I completely off.
All I want to do is have the entry of the zip populate the town field or the entry of the town populate the zip field
Please advise
by donq
build 2 queries:
1 named "qcTown" (for query/combo town) based on your table and sort on Town. Run the query and if it produces what you want swich to SQL view and copy the text into the clipboard. Open the combo boxes properties sheet and paste the clipboard into the "Row Source" field.
repeat the process building "qcZip" but sort on zip. If everything works repeat your copy and paste to the appropriate combo boxes Row Source property field.
Good luck - Don Quigg
by pstempien
by jonhouston
I am fairly new to access programming but maybe this will help
In your town combo boxes change event you could requery the database to fill in the zip combo with just the correct zip
ex.
zipComb.SetFocus
zipComb.RowSourceType = "Query/Table"
zipComb.RowSource = "SELECT zipField FROM Table where (town='" +townComb.Value+ "')"
This statement would then fill the zip combo with the zip that matches the current selection in the town combo box.
You could likewise do the same process for the other combo.
I hope this makes sense.
by pstempien
by sankulpune
Hello pstempien,
Use the Bound Column property of the combo box to assign appropriate value (Town or ZIP) from the selected row, to the underlying field.
Suppose column 1 of your drop down list is town and column 2 is zip.
To assign Town tothe underlying field, set Bound Column property to 1.
To assign ZIP to the underlying field, set Bound Column property to 2.
I hope this solves your problem.
You select a row from the drop down list of the combo box and not a field like Town or ZIP. Value from which column of that row is assigned to the underlying field is controlled by the column number assigned to the Bound Column property.
The value you see in the form and the value assigned to the underlying field can be different.
The relationship between the no. of columns in the row source object (query / table), the columns displayed in the drop down list of the combo box, the value displayed in the combo box itself and the value assigned to the underlying field (control source of the combo box) is a very complex. It depends on the values assigned to a number of properties of the combo box.
If you need detailed explanation on this, I would be glad to forward it to you.
with regards,
SanganakSakha.
SimpleAnd Effective Solutions To Small Problems, No QuickFixes.
by pstempien
I beleave the easiest way to solve your problem is to get someone who understands access to code it for you.
You have rejected two acceptable awnsers with the excuse "To complicated".
Why do you say that a two lines of code solution is complicated????????
Was your brain initiated?????
by pstempien
by hurin
I think that yes your problem seems simple, but the problem with many things that on the surface look easy really they are not, Basically Access is not intuative, and does require some thought. It is unfortunate that you have rejected some of your replies, because they have given you the correct answer.
Hurin.
p.s you are correct in calling the idiot a computer snob, comments from people like that do the industry and this community no good, are totally unrequired and show how little theyknow about reality and people.
by pstempien
by it_cowboy
ok, you have 2 combo boxes, one called cboTown and one called cboZip
assign the same underlying table to both combo boxes (assuming that the town and zip exist in the same table).
Make sure both town and zip fields are selected, but for cboTown,select Town as the first field then Zip as the second field, for cboZip, select Zip as the first field then Town as the second field.
For the OnClick event for cboTown, make Me!cboZip = Me!txtTown.Column(1) (the Zip Code)
For the OnClick eventfor cboZip, make Me!cboTown = Me!cboZip.Column(1) (the Town)
by it_cowboy
oops, second last line should read...
For the OnClick event for cboTown, make Me!cboZip = Me!cboTown.Column(1) (the Zip Code)
Access is pretty simple, it just requires a bit of understanding. Dont get me wrong, im not having a shot, as its taken me a few years to get a handle on the simplicity of some things in access.
I did an advanced course once over 2 days, our tutor told us he could not even show us 5% of access in that time. its a practice thing.
For the idiots, everything is simple when they know nothing about it, unconscious ignorance...
by pstempien
by pstempien
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending