DataCombo problem

  • Thread starter Thread starter R
  • Start date Start date
R

R

Hi, I'm really stuck here.
I have a data combo called cmbHvem which I link to a recordset RS23 like
this

If RS23.State = adStateOpen Then
cmbHvem.RowSource = Nothing

RS23.Close()

End If

SQL = "SELECT AID,(FNavn + ' ' + ENavn) AS Ans FROM Ansatte WHERE KID = '" &
varKID & "'"

RS23.let_Source(SQL)

RS23.Open()

cmbHvem.RowSource = RS23

cmbHvem.BoundColumn = "AID"

cmbHvem.ListField = "Ans"

To get the employees from the selected contact.

Then I want to set the combo value to one particular employee

I get a value from another query, RS1, and try this

cmbHvem.BoundText = RS1.Fields("AID").Value

This works once, this is part of a code on a "Dialog-form-box", the next
time I open the same dialog, the code is not working.

The value of RS1.Fields("AID").Value is like 115, but the combo is not
changing to record 115.



Helppppp



Ronny
 
I forgot to mention that the code below worked in VB6, when I try to move to
VB.NET I get this error.
Should I do somthing before closing the second form?

Ronny
 
Hi R,

This is a VB.net language newsgroup, in VB.net is normaly either a datacombo
or a recordset used.

For that you probably get a better answer in one of the classic VB
newsgroups

microsoft.public.vb

I hope you find your solution.

Cor
 
Hi Jose,

It is the best answer I had and when I was sended it I did not had the
message that it was an update. It did totaly look VB6. The update message
came with me at the same time as my own.
But correction than is no more possible.

Cor
 
Apology accepted :-)
Do you have an ansver? Anybody?
It is a VB.NET question, I just mentioned that it worked in vb6...
I have a suspicion that I do not close my for properly...

Ronny
 
Hi R,

You can try the newsgroup

microsoft.public.dotnet.languages.vb.upgrade

Mostly Herfried does not want to help with this kind of question here, but
he sometimes do that in that newsgroup (and maybe because I write it here
you are lucky and he does it here)

:-)).

But using those controls stays a problem, I think that it is better that
when you have a problem to change directly to real dotnet controls.

The datacombo does not exist but the combobox is a good replacement I think.
(It is the most buggiest control from Dotnet in my opinon but very good
usable).

To bind a datasource to a combobox is real very easy.

And when you have luck and have I written something wrong above because I do
not know so much anymore from VB6 and than Herfried corrects it.

:-)

But I hope this helps anyhow?

Cor
 
Back
Top