cancel
Showing results for 
Search instead for 
Did you mean: 

Feel a combobox wit a Query

Former Member
0 Kudos

Hi all:

I want to feel a combobox with the result of a Query, but I can't get the result when I feel it, can any one help me pls.

Here is the code:

dim oprom as sabbouicom.combobox

oRecordset.DoQuery ("SELECT PrjName,PrjCode From OPRJ ")

Set oprom = oForm.Items.Item("11").Specific

oprom.DataBind.SetBound True, "OPRJ", "PrjName"

If oRecordset.RecordCount <> 0 Then

oprom.ValidValues.Add(.Fields.Item("PrjName").Value, .Fields.Item("PrjCode").Value)

End If

End With

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorry for my post, I wrote it wrong, "Feel a combobox wit a Query", it was fill a combobox with a Query

My problem has solved thank's any way

Former Member
0 Kudos

Natalia,

I'm very interesting in the way you solve your problem. Can you post the modification you've made on your code ?

Thanks a lot

Sebastien

Former Member
0 Kudos

Hi Sébastian:

It was just a syntaxis error:

oRecordset.DoQuery ("SELECT PrjName,PrjCode From OPRJ ")

For i = 0 To oRecordset.RecordCount - 1

If oRecordset.RecordCount <> 0 Then

oprom.ValidValues.Add oRecordset.Fields.Item("PrjName").Value, oRecordset.Fields.Item("PrjName").Value

' oprom.ValidValues.Add(.Fields.Item("PrjName").Value, .Fields.Item("PrjCode").Value)

End If

Next i

Former Member
0 Kudos

Natalia,

Did you manage how to get the selected value from this Combobox ????

I'm trying .... but it is not working.

Jone.

Former Member
0 Kudos

Hi Joneval,

you can get the selected value from the ComboBox simple with:

sComboValue = oComboBox.Selected.Value

'// or if you want to get the description

sComboDesc = oComboBox.Selected.Description

Best regards

Libor.

Former Member
0 Kudos

when we want to get combo value we must check first if the value selected is empty or not

if oTmpForm.items("47").specific.selected is nothing then

Msgbox("the value is empty")

else

Dim XXX as string [ or integer] depending of the combobox dield

XXX = oTmpForm.items("47").spesific.selected.value

End if

Former Member
0 Kudos

HI all,

I have a basic proplem! I want to know if I can change the ITEMs in system forms' comboboxes(for example: summary type combobox in order form).

If it is possible please show me the way.

best regards.