473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Bound Combo Box with Value List not showing multiple columns

Seth Schrock
2,965 Expert 2GB
Is there some known issue in Access 2013 where a combo box with a value list and two columns can't be bound? I tried it using the Row Source of "M";"Male";"F";"Female". When I set the Control Source property to the proper field, it gave me the M and F in the same row and that was it. When I cleared the Control Source property, it displayed the following like I wanted it to:
Expand|Select|Wrap|Line Numbers
  1. M     Male
  2. F     Female
I tried deleting the combo box and starting over using the wizard and it did the same thing. I ended up just changing it to a single column of M or F, but I would like to know for the future what the problem is or if it is a design limitation.
Jul 13 '15 #1
7 1328
jforbes
1,107 Expert 1GB
Hey Seth,
I created this in a Test Database and didn't run into any problems. Properties for the Test database:
Expand|Select|Wrap|Line Numbers
  1. ColumnCount=2
  2. ColumnWidths=1;1 (0;2 to hide the first column)
  3. ColumnHeads=No
  4. ListWidth=2
  5. RowSource="M";"Male";"F";"Female"
  6. RowSourceType=Value List
  7. BoundColumn=1
  8. LimitToList=No
... Maybe having something to compare it to will help.
Jul 14 '15 #2
Seth Schrock
2,965 Expert 2GB
Did you have your combo box bound to any field? Those are just about exactly my setting. I don't remember my ListWidth property for sure, nor the LimitToList, but neither should affect that anyway.
Jul 14 '15 #3
zmbd
5,501 Expert Mod 4TB
What is the data type cast of the bound field?
Wrong type cast is usually the issue.
Jul 14 '15 #4
Seth Schrock
2,965 Expert 2GB
Text with a size of 1. I'm only wanting to store the M or F, but display the Male and Female.
Jul 15 '15 #5
jforbes
1,107 Expert 1GB
Yes, the field was Bound to a Text Data Type with a Field Size of 1.
Jul 15 '15 #6
zmbd
5,501 Expert Mod 4TB
Created a form in my test database.
Bound to text(1)
Rowsourcetype = List
Rowsource= "M","Male","F","Female"
Bound to 1
ControlSource = Test_Sex

Stored the value selected without issues.

So you have any events attached to the control?

... lets look at the control properties...

Insert a standard vba modal.
Cut and past the following:
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Public Function LstFrmCtrlPrprtys(z_in_formname As Form, z_in_ctrlname As String)
  5.     Dim zform As Form
  6.     Dim zctrl As Control
  7.     Dim zprp As Property
  8.     Dim zFreeFile As Integer
  9.     Dim zTxtFile As String
  10.     Dim zflag As Boolean
  11.     '
  12.     On Error GoTo ZErrorTrap
  13.     If IsNull(z_in_formname) Or (z_in_ctrlname + "" = "") Then
  14.         LstFrmCtrlPrprtys = False
  15.         Err.Raise 9999
  16.     End If
  17.     zflag = False
  18.     '
  19.     LstFrmCtrlPrprtys = True
  20.     '
  21.     Set zform = z_in_formname
  22.     Set zctrl = zform.Controls.Item(z_in_ctrlname)
  23.     zctrl.SetFocus
  24.     '
  25.     zTxtFile = Environ("Userprofile") & "\documents\PrptyLst" & Format(Now(), "yyyymmddhhmmss") & ".txt"
  26.     Debug.Print "FileLocation=" & zTxtFile
  27.     zFreeFile = FreeFile
  28.     Open zTxtFile For Output As zFreeFile
  29.     '
  30.     Print #zFreeFile, "[PrprtyName]"; Tab(25); "[PrprtyType]"; Tab(38); "[PrprtyValue]"
  31.     zflag = True
  32.     For Each zprp In zctrl.Properties
  33.         With zprp
  34.             Print #zFreeFile, .Name; Tab(25); .Type; Tab(38); .Value
  35.         End With
  36.     Next zprp
  37.     zflag = False
  38.     '
  39. ZErrorCleanUp:
  40.     '
  41.     Close zFreeFile
  42.     If Not zctrl Is Nothing Then Set zctrl = Nothing
  43.     If Not zform Is Nothing Then Set zform = Nothing
  44.     'the following will sometimes cause the code to fail
  45.     'If CurrentProject.AllForms(z_in_formname.Name).IsLoaded Then DoCmd.Close Objecttype:=acForm, ObjectName:=z_in_formname.Name
  46. Exit Function
  47. ZErrorTrap:
  48.     If zflag Then
  49.         Debug.Print "*", zprp.Name, Err.Number, Err.Description
  50.         Print #zFreeFile, "*", zprp.Name, Err.Number, Err.Description
  51.         Resume Next
  52.     Else
  53.         MsgBox Err.Number & ", " & Err.Description
  54.         If Err.Number = 9999 Then Exit Function
  55.         LstFrmCtrlPrprtys = False
  56.         If Not LstFrmCtrlPrprtys Then Exit Function
  57.         Resume ZErrorCleanUp
  58.     End If
  59.    '
  60.    ' to use,<Ctrl><G> enter
  61.     '?lstfrmctrlprprtys(form_frm_formname,"z_ctrl_txtbx_nameofctrl")
  62.    'where form_frm_formname is the form as a form object
  63.    '"z_ctrl_txtbx_nameofctrl" is the name of the control on the form
  64. End Function
Look at the last comment line for example of usage.

I have a form named "frm_customdbprop" in the vba object tree it is listed as "form_frm_customdbprop" so that is what I enter the line and the following is returned:
<ctrl><g>
Expand|Select|Wrap|Line Numbers
  1. ?lstfrmctrlprprtys(form_frm_customdbprop,"z_ctrl_txtbx_filelocation")
  2. FileLocation=C:\Users\zmbd\documents\PrptyLst20150715125440.txt
  3. *             InSelection    2187         This property is available only in Design view.
  4. True
The file path is right there so you can C&P into windows-explorer navigation.
I use this in one of my documenting codes hence the true/false return at the end
It should drop a file in your documents folder modify the zTxtFile string as needed for your system.

Attach the text file that this creates and we can take a much deeper look at the control.

:)
Jul 15 '15 #7
Seth Schrock
2,965 Expert 2GB
Here is the text file. I did double check the field that it is bound to and it is a text with field size of 1. It does have a validation rule on it though: Is Null Or "M" Or "F"
Attached Files
File Type: txt PrptyLst20150717195220.txt (6.6 KB, 286 views)
Jul 17 '15 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steven K | last post by:
Hello, I have long list of names that I would like to wrap across multiple columns (like a newspaper). Are there any suggestions on how to go about this? -- Thanks in advance, Steven
1
by: Steve | last post by:
I'm sure this question has been asked before, but I couldn't seem to get the right combination of words to get a hit. I'm looking to do one of two things... 1) Take a list of items, and have...
2
by: Simon Harris | last post by:
Hi All, I have an app which requires a list of coutries to be displayed, so far I have a datagrid which contains displays the countries Ok, along with flag images, these are also links to my...
1
by: James | last post by:
I am used to VB6 but need to develop something in .Net. I need to create several bound combo-boxes which will use lookup tables to get their values. I created a form using the dataform wizard....
9
by: Vmusic | last post by:
Hi, I'm using MS Access 2002. I have a form with a combo box built from a query that returns one column, and that one column is the bound column. How do you use VBA to programmatically change...
3
by: Cagey | last post by:
What I'm trying for: If this selection or if click on selection (highlighted line choice/ which ever selection change) w/in query's combo dropdown list box (on Switchboard), then Open in...
3
by: Bill | last post by:
I have what I think should be a simple question regarding a bound combo box. My first table is Dealers: DealerID - primary key DealerName BillToLocation My second table is Locations:...
0
by: bbaamm | last post by:
he database result is as follows DATE code class1 class2 class3 1/8/10 M1 10 20 30 3/8/10 V2 20 30 10 1/8/10 H1 1 2 3 ...
1
by: Yousaf Shah | last post by:
Hello everybody Suppose we have two bound combo boxes, "PositiveGPE_Finding" and "Lymphnode_Gp" respectively, in form named "History". "PositiveGPE_Finding" combo box have value list with Multiple...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.