Selection issue

  • Thread starter Thread starter Fay Yocum
  • Start date Start date
F

Fay Yocum

On loading of a form I have a datagrid loaded, If there is only one person
in the database I want that record to automatically be selected. I used this
code and it works.At least the one row is highlighted.
If Me.BindingContext(DsPerson1, "tblPerson").Count = 1 Then

DataGrid1.Select(0)

End If

Prior to including this code I had the following code on the open click
event.
If PK = 0 Then

MsgBox("You must select a person, then click Open.")

PK indicates that no record has been selected hence the 0.

My problem is that I get the message box even though the above code
apparently had selected the one and only record.

Any ideas? Thank you for your time.

Fay
 
Hi Fay,
My problem is that I get the message box even though the above code
apparently had selected the one and only record.

I think it depends upon how PK is getting set and from the sounds of it, it
isn't getting set... but rather than set PK perhaps you can reference
DataGrid1.CurrentCell.RowNumber()

Tom
 
Back
Top