Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box-want to dispaly only one column from value list

Status
Not open for further replies.

madu

IS-IT--Management
Feb 20, 2002
11
US
Hi,
I have a combo box in my data entry form.And I created it using wizard,I have 2 columns in the value list.But I want only one to be displayed on the forms and the other column I want it to save the value to the table.But the form displays both the columns when the combo box is selected.Is there a way to make it display only one column?Or is there any other solution to this?Any code to write in the on-click even?
Also I want to know is it possible to save "Yes" or "No" or any value I want, to the tables when the option button is selected or deselected(right now it stores -1 or 0).
I am new to Access,I appreciate any help.
Thanks,
Madu.
 
To the second question:

If the option button is bound to the table, then I believe the choices are 0 and -1.

If the option button is an unbound control, you can use it to specify any value you want.
Code:
_____________________________________
Sub ctlOption_AfterUpdate

Dim strOptionVal as String

   If ctlOption = -1 Then
      strOptionVal = "Yes"
   ElseIf ctlOption = 0 Then
      strOptionVal = "No"
   End If

NameOfYourTableField = strOptionVal

End Sub
_______________________________________

HTH
John

Use what you have,
Learn what you can,
Create what you need.
 
Hi,
Thank you very much both of you,
Madu.
 
Hi John,
I tried your code,but still it's saving 0 or -1 in the tables.And the opt buttons are unbound.Do you have any ideas as to why it is still saving 0 and -1?
Thanks,
Madu.
 
Madu,


If the field in your table is a yes/no datatype, then 0, -1 and Null are the only choices.

If you really want the words 'yes' and 'no' (or any text string) saved as the field value in your table, then set the field to a text datatype in the table's design view.

HTH


John John

Use what you have,
Learn what you can,
Create what you need.
 
Hi John,
Actually the code is workign now,the field datatype is text already.But now the problem is :
Lets say I have 2 text boxes in the form,
one is COMPID and the other is LANGID(primary key).
I want to use several option buttons(say 5 or 6) and when more than one is selected,I want to save different values in the table with the same COMPID(which is working) and also I want to save the LANGID(it can be any number,but unique),I tried to increment it by one in the code,but it is saving only one record.
For Ex:
When I type 1001 in COMPID and 2000 in LANGID and select 2 option buttons say ENGLISH and SPANISH
I want to save 2 records in the table like:

COMPID LANGID LANGTYPE

1001 2000 1
1001 2001(or any #) 2


Please let me know if it is possible or not?
Thanks,
Madu.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top