UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Use The Text And Not The Associated Key.    
 
   
leaning
post Dec 19 2011, 01:24 PM
Post #1

UtterAccess Addict
Posts: 114



Hello!

I have a DogName combobox that uses tblDog.tblDogIDpk, but displays tblDog.DogName.

So, the text is displayed in the combobox dropdown, but the key for that text (1,2,3,etc.) is what is stored in the table.


1) When I click on the combobox on the form and click "Find", it wants to search for the keys rather than text.

2) Also, I want to enable another combobox based on what's displayed in the DogName combobox. I tried "If DogName= "Fido" then disable cmbCat", but again, that box is tied to the key. So I have to set it up like "If DogIDpk = 12, then disable cmbCat." I'd rather refer to the text rather than a key number.

Hopefully, someone can see what I am getting wrapped around and give me a nudge.

Thanks!

Lost
Go to the top of the page
 
+
leaning
post Dec 19 2011, 01:24 PM
Post #2

UtterAccess Addict
Posts: 114



Hello!

I have a DogName combobox that uses tblDog.tblDogIDpk, but displays tblDog.DogName.

So, the text is displayed in the combobox dropdown, but the key for that text (1,2,3,etc.) is what is stored in the table.


1) When I click on the combobox on the form and click "Find", it wants to search for the keys rather than text.

2) Also, I want to enable another combobox based on what's displayed in the DogName combobox. I tried "If DogName= "Fido" then disable cmbCat", but again, that box is tied to the key. So I have to set it up like "If DogIDpk = 12, then disable cmbCat." I'd rather refer to the text rather than a key number.

Hopefully, someone can see what I am getting wrapped around and give me a nudge.

Thanks!

Lost
Go to the top of the page
 
+
Bob G
post Dec 19 2011, 01:26 PM
Post #3

UtterAccess VIP
Posts: 8,106
From: CT



what is the bound column of the combobox ??
Go to the top of the page
 
+
Doug Steele
post Dec 19 2011, 01:29 PM
Post #4

UtterAccess VIP
Posts: 17,613
From: Don Mills, ON (Canada)



When you simply refer to a combo box, you're going to get the value of the BoundColumn for the selected row.

To get the value of any other column, use the Column collection: If Me!DogIDpk.Column(1) = "Fido" ...

Note that the Column collection starts numbering at 0, so Column(1) refers to the value in the second column of the selected row.
Go to the top of the page
 
+
leaning
post Dec 19 2011, 01:40 PM
Post #5

UtterAccess Addict
Posts: 114



Bob G,

1) Record Source: Is a query. Column 1 is 0" long (tblDog.tblDogIDpk), Column 2 is 2" long (tblDog.DogName)
3) Bound Column: Column 1 (tblDog.tblDogIDpk)
4) Control Source: tblDogStuff.tblDogIDfk

HTH

Lost
Go to the top of the page
 
+
Bob G
post Dec 19 2011, 01:42 PM
Post #6

UtterAccess VIP
Posts: 8,106
From: CT



change the boundcolumn to 2 and see if that works for you
Go to the top of the page
 
+
leaning
post Dec 19 2011, 02:44 PM
Post #7

UtterAccess Addict
Posts: 114



Bob G,

Here is how I dumb it down for me for comboboxes:

Record Source: What you want to see in the combo box.
Bound Column: What column of the underlying query is going to be put into the storage table.
Control Source: What field of the storage table is going to be used.

Using this, if you change the bound column to 2, now the DogName (Fido, Rover, etc.) gets put in the storage table. If that happens, you get a bunch of Fidos and Rovers being stored instead of just the numeric keys (1, 2, 3).

DougSteele had what I needed: Conditional Format> Expression is: [cmbDogIDpk].Column(1) = "Fido". Then click the Enabled button. You have to refer to the name of the object rather than the name of the field.

Thanks, all! And sorry about triple posting!

Respectfully,

Lost
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 03:31 AM