Solved

add new record in TDBGrid

Posted on 1998-03-01
4
383 Views
Last Modified: 2012-06-27
hi, I have a VB program to connect to SQL database using RDO. in my application, I use TDBGrid to browse the records.
I have all MoveFirst, MovePrevious, MoveNext, MoveLast buttons working properly, But I have the following errors:
1. I want to have a New button, It bring me to the new row, but It doesn't hightlight(focus) in the first column so that I can type in without moving the mouse to there and click on it. How can I do that? routines will be helpful, sample codes even better.

Thank you

Chris Leehi, I have a VB program to connect to SQL database using RDO. in my application, I use TDBGrid to browse the records.
I have all MoveFirst, MovePrevious, MoveNext, MoveLast buttons working properly, But I have the following errors:
1. I want to have a New button, It bring me to the new row, but It doesn't hightlight(focus) in the first column so that I can type in without moving the mouse to there and click on it. How can I do that? routines will be helpful, sample codes even better.

Thank you

Chris Lee
0
Comment
Question by:ny971181
  • 2
4 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1458222
you can try this in the new buttons click event...

tdbgrid1.setfocus
tdbgrid1.column = 0
0
 
LVL 1

Author Comment

by:ny971181
ID: 1458223
Oh, my god!
first of all, your answer is straight forward wrong!
second, no explanation on your code!


I figured this answer out last night. Here is something else I need you guys help me out:
I made a new button, It works well: It places the cursor on the first column as I wanted once I hit it. Then I entered my data. Now, My problem is when I finished data entry, I have to click on other rows so that new data is saved on the resultset. but if I hit the close button of the windows, It says: No Current Row.
If I hit the movefirst of movenext button, It gives me the same error. So Now I like to have a save button so that when I finished data entry, I could hit save to save(update) the recordset.

Thank you very much and have a nice day!

chris Lee
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1458224
am I supposed to help you with your attitude?  Smartass, the example I displayed worked no problem with dbgrid.  If it didn't work with tdbgrid, then tough.  I don't appreciate your attitude, and have no intention on helping you with your next problem, although I do know the solution.  
0
 
LVL 1

Accepted Solution

by:
sachinkas earned 20 total points
ID: 1458225
Hi

You can stop the user by giving
in the form unload

if tdbgrid1.datachanged=true then
   msgbox "Record filling incomplete"
cancel=true
endif

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now