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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempting to edit record in dbgrid gives "No Current Record" error.

Status
Not open for further replies.

RZillmer

Programmer
Nov 20, 2001
42
US
Wow...my subject is so descriptive that I barely have to write anything here!

Anyways, my dbgrid is bound to a data control on the form. Allow updates is set to true for the grid and the data control is not read only and is dynaset.

I have text boxes on the form that display info from the currently selected record of the data control and they change appropriately as I select different rows in the grid, so I have no clue why it's telling me there is no current record.

I guess I should add that I'm trying to edit data in the grid by physically clicking on a cell and typing in it, not programmatically.

Thanks in advance for any help.
 
Is AllowInserts / whatever set?

You might want to test eof/bof as well - something like

if data1.recordset.eof or data1.recordset.bof then

problem

else

all is well

endif
 
I set the grid to allow inserts. I still got the same error. Also, it then put a line to insert a new record. I don't really want one of those, but just to test I tried adding a record with it and got the error again.

As for .eof/.bof testing, I'm guessing it's not because I can see the records there. If I were to test for it, where should I put this in the code?

I've used vb for a while, but never these grids. Do I have to build code for editing records or is that built into the control? Currently, there is none of my code behind this control. Is that the problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top