I can't select value from a combobox why?

bmkol

Member
Local time
Today, 10:13
Joined
Dec 2, 2021
Messages
39
I have a form (Hebrew) with few comboboxes all of them working good except one that not letting me selecting a value and I can't understand the problem
Here are 2 screen shuts the first one is where I want to select and the second one is after I selected

1.
1639518122792.png


2.
1639518196918.png


It give me just the first one all the time

Please help
 
What is the control source? Is the field locked?
 
What is the control source? Is the field locked?
It doesn't have a control source becuase it based on vba code

1639518711340.png
 
Sounds like the bound column may have duplicate values. Does it?
 
If the combo's are used to filter or search records on the form they should be unbound otherwise you will be editing the (first) record with every change.
EDIT: too late, I see you have them unbound. Would you please show us the VBA code that sets the row source?

Cheers,
 
Sorry, that's not what I meant. For example, typically, a combobox would display one column but actually have a hidden one, which is the bound column. If so, I was saying perhaps that hidden column contains duplicate values, like this:

1, Item1
1, Item2
1, Item3
etc...
 
Sorry, that's not what I meant. For example, typically, a combobox would display one column but actually have a hidden one, which is the bound column. If so, I was saying perhaps that hidden column contains duplicate values, like this:

1, Item1
1, Item2
1, Item3
etc...
It has one hidden column (the id) ... here is the vba code:

strSqlPerek = "SELECT tblPasuk.ParashaId, tblPasuk.PasukNum FROM tblPasuk WHERE (tblPasuk.ParashaId=" & Form_frmPsukim.cmbParasha.Value & ") AND " & " (tblPasuk.PerekNum='" & Form_frmPsukim.cmbPerek & "') "
Me.cmbPasuk.RowSource = strSqlPerek
Me.cmbPasuk.Requery
Me.cmbPasuk = Me.cmbPasuk.ItemData(0)
 
Can we see the vba code that is the underlying code?
here it is:

strSqlPerek = "SELECT tblPasuk.ParashaId, tblPasuk.PasukNum FROM tblPasuk WHERE (tblPasuk.ParashaId=" & Form_frmPsukim.cmbParasha.Value & ") AND " & " (tblPasuk.PerekNum='" & Form_frmPsukim.cmbPerek & "') "
Me.cmbPasuk.RowSource = strSqlPerek
Me.cmbPasuk.Requery
Me.cmbPasuk = Me.cmbPasuk.ItemData(0)
 
So it looks like theDBGuy was right, you are selecting only one ID for your bound (hidden) column: =" & Form_frmPsukim.cmbParasha.Value
And you don't need the requery after you set the row source. And why select the first entry?
 
So it looks like theDBGuy was right, you are selecting only one ID for your bound (hidden) column: =" & Form_frmPsukim.cmbParasha.Value
And you don't need the requery after you set the row source. And why select the first entry?
But I do have 2 columns as in the picture when the first one is hidden

1639520185067.png
 
O.K ... I found the problem ... from what

bastanu asked ... I changed the bound to 2 and it is ok now.​

1639520461462.png



Thanks to evryone that tried to help
 
You are using the combo itself as criteria for its RowSource. That doesn't sound right.

PS - you can just put the query into the RowSource. You don't need code to load it.
 

Users who are viewing this thread

Back
Top Bottom