?
Solved

Create New Row in DBGrid

Posted on 1999-01-11
5
Medium Priority
?
217 Views
Last Modified: 2013-12-25
I have an unbound DBGrid which I would like users to be able to add new rows to at run-time.  They are able to add the first row, but when they try to click in the next row, nothing happens.  The AllowAddNew property is set to True.  I tried setting the rowbookmark on the unboundadddata event.  When I do that, it allows me to add a new row, but the first row is overwritten by the data entered into the new row.
0
Comment
Question by:ZVE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Author Comment

by:ZVE
ID: 1489560
Adjusted points to 100
0
 

Expert Comment

by:jmnolan
ID: 1489561
When you add a new row it erases the data that you are entering in the current row. You have to save the data from the grid to the array you are using to store your data. A good way to do it is to check the CurrentCellModified property to see if you do actually need to save it. Let me know if this helps!
0
 

Expert Comment

by:jaggoo
ID: 1489562
Question is not clear whether DBGrid's "AddNew" method was used to insert a new row in the grid. If not used, row pointer will not get shifted. Hence, rows are overwritten at current row edit.

0
 
LVL 1

Expert Comment

by:RamRam111798
ID: 1489563
check the sample Unbndgrd.vbp in samples directory
0
 
LVL 8

Accepted Solution

by:
vettranger earned 200 total points
ID: 1489564
AllowAddNew only applies when letting the user add records to a recordset object bound to the dbgrid control.

For your purpose, you need to control the grid yourself with the .row property in connection with the rowcolchange event.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question