Solved

Insert new record by using DBNavigator

Posted on 2004-04-26
8
605 Views
Last Modified: 2010-04-05
I have 6 fields (title,quit,answ,wrong1,wrong2 and wrong3 )>>
I do not like to write value of "title" every inserting so I want to fixed the text of editbox
so when I insert new recorde all editboxs will be clear exept the editbox of "title"?
0
Comment
Question by:sal1150
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 10921456
Usualy TDBNavigator works together with TDBGrid and / or TDBEdits. If your data will be entered into TEdits, you don't need a TDBNavigator to post a new record, but you can use a button....
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 10921535
what kind of database do you use ?
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10921569
in your code,

create a Global variable

Example:

var
 MYText: String;


Set the tables Fields Default value = to your title

MyTableField.AsString:= MyText;

OR

select the DBNavigator

Go to its buttons property, and select the insert button

then go to its onCLick event

procedure TfrmTeams.wwDBNavigator1InsertClick(Sender: TObject);
begin
 DBEdit1.Text:=  MyText;
end;


Now anytime, MyText valeu changes and you do a insert from the TDBNavigator, you rDBEdit will be updated with the new default value

Shane
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:mokule
ID: 10921635
Hi
I understand that Your database is in early stage so I advise You:
Divide Your data into 2 tables

Table Titles with fields Tit_Id, Tit_Title
Table Answers with fields Ans_Id, Ans_TitleId, Ans_quit,Ans_answer, ...

Let Tit_Id and Ans_Id be autoincrement fields and Key fields.
Field Ans_TitleId should be equal to Tit_Id Field for corresponding title

Maybe it's a little bit more difficult in implementation but has some important advantages.
First of all in case of erroneous Title You need to correct only one record.
Besides Your databese will be more compact.
0
 

Author Comment

by:sal1150
ID: 10921756
shaneholmes
can u explane more...I do not find "buttons property"
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10921826
Click on the DBNavigator so that it is selected, then there is a buttons property in the object inspector which gives you access to the buttons of the DBNavigator. Click the ellipse to get to each individula button, click on the insert

SHane
0
 

Author Comment

by:sal1150
ID: 10922414
sorry i did not find  "buttons property"
did u mean "visiblebuttons"?
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 250 total points
ID: 10922466
Duh, my bag - what a freak I am, I was giving you the instructions for a InfoPower component which i use alot

Sorry -

Do the following:

In YOUR TDBNavigators OnCLick event, add the following:

if Button = nbInsert then
              DBEdit1.Text:=  MyText;


OR


case button of
 nbInsert: begin
                DBEdit1.Text:=  MyText;
               end:
 nbDelete:begin
                 //  
               end;
 etc, etc, etc,
end;

Shane
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

710 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