Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Update Error

Status
Not open for further replies.

dgriffin

Programmer
May 26, 2001
50
0
0
US
I am trying to let the user toggle a boolean field (Yes/No) by double-clicking on the record line in a datagrid. This is the sub that I have, and I am getting a 6160 Data Access Error on the ...Text = ... lines. I have the datagrid set to AllowUpdate, and Enabled and such. I am using an ADODB.Connection for the datagrid recordset.

Code:
Private Sub DataGrid_DblClick()

    DataGrid.Columns("BO").Locked = False
    If DataGrid.Columns("BO") = "Yes" Then
        DataGrid.Columns("BO").Text = "No"
    Else
        DataGrid.Columns("BO").Text = "Yes"
    End If
    DataGrid.Columns("BO").Locked = True

End Sub

Where am I going wrong?

Thanks,
Dan
 
What happens if you remove the ".text" and just have

datagrid.columns("BO")= "Yes"

it may be that you should be using the value property rather than the text property here

Transcend
[gorgeous]
 
Thanks for your response. Although I have checked all those simple things, I'm sure it is something equally simple that I'm just not thinking of. I've tried all three...

datagrid.columns("BO") = "Yes"
datagrid.columns("BO").Value = "Yes"
datagrid.columns("BO").Text = "Yes"

...resulting in the SAME error message!

"Data Access Error"

Baffling. That's why I'm here. If Microsoft would provide meaningful error messages I could probably figure it out myself.

I've searched this forum and scanned the FAQ's, but this is referenced only twice (I think), and even then they were talking about altogether different situations.

The Microsoft web site isn't any help either. It mearly aluludes to things like not being logged in as ADMIN, Opened Exclusive, Read Only, etc. None of which are the case here.
 
Hi griffin,

even though the data grid is good, its knwo for too many bugs. A good option is flexgid with control floating top of it.
below mentioned will help you.
dgdRegister.Columns(0).Button = True
dgdRegister.Columns(0).NumberFormat = "Yes/No"

regards
john

*** Even the Best, did the Bad and Made the Best ***

John Philip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top