[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

10/07/2008 at 10:55AM PDT, ID: 23794636
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Delphi - Dbl Click row from ADO Query result grid - open another form / grid with that record selected.

Asked by a3dvm in Delphi Programming

Tags: Delphi, ADO

Hi Experts
Delphi app using Access ADO tables.
I currently have two forms to check for duplicate redords. The main duplicates form has a grid showing all record details and a button which opens a sub form to run two ADOqueries (via buttons) to check for duplicate Last Names, and the other, duplicate addresses, results shown in a grid.
Because the sub form grid has less detail for checking purposes (and because I don't know how to locate or find a pointer to a given record in a query to delete it) the sub form has to be closed in order to search for and delete any duplicates found. This is laborius.
Can any one help me with the code to double click on a record in the sub form grid (it's a query result) so that it closes the sub form, and returns to the main duplicates form (still open in the background) but with the sub form 'double clicked' record selected?
There is an 'ID' field (record number) that could be used for identification...?
As I'm only a novice at Delphi - I'd appreciate your indulgence by showing me the code and explaining where it should fit in with the above.
Additional Info: On the main form the DBGrid1 has data source1 linked to DataModule1.Contacts, and on the sub form another data source1 linked to ADOQuery1.
Many thanks,
A3dvm
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
Heres the sub form code:
 procedure TFormDupLastName.FormCreate(Sender: TObject);
begin
    DBGrid1.Columns.LoadFromFile('C:\No25Data\Text\Grid_DupLastName_Width.txt') ;
     LabPressBtn.Visible:=True;
end;
      //Save grid data
procedure TFormDupLastName.FormClose(Sender: TObject; var Action: TCloseAction);
begin
       DBGrid1.Columns.SaveToFile('C:\No25Data\Text\Grid_DupLastName_Width.txt') ;
  end;
      // Close form button  = focus EdSearch
procedure TFormDupLastName.sBitBtn2Click(Sender: TObject);
begin
     ADOQuery1.Close;
     ADOQuery1.SQL.Clear;
     Close;
     FormDuplicatesCheck.EdSearch.SetFocus;
     LabPressBtn.Visible:=True;
     LabDupAdd.Visible:=False;
     LabDupName.Visible:=False;
end;
       // Dup Last Name
procedure TFormDupLastName.DupLastNameBtnClick(Sender: TObject);
begin
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      ADOQuery1.SQL.Add ('select distinct a.ID as [ID], a.Name_First as [First Name], a.name_last as [Last Name], a.Add_Hsename_nbr as [Hse Number], a.add_Street as [Street], a.add_district as [District] from contacts as A, contacts as B');
      ADOQuery1.SQL.Add ('where A.name_first=B.name_first and A.name_last=B.name_last and A.id<>B.id order by a.name_last, a.name_first, a.id');
      ADOQuery1.Parameters.Clear;
      ADOQuery1.Open;
      DBGrid1.Columns.LoadFromFile('C:\No25Data\Text\Grid_DupLastName_Width.txt') ;
      LabPressBtn.Visible:=False;
      LabDupName.Visible:=true;
      LabDupAdd.Visible:=False;
      end;
           //Dup Address button
procedure TFormDupLastName.DupAddBtnClick(Sender: TObject);
begin
      ADOQuery1.Close;
      ADOQuery1.SQL.Clear;
      ADOQuery1.SQL.Add ('select distinct a.ID as [ID], a.Name_First as [First Name], a.name_last as [Last Name], a.Add_Hsename_nbr as [Hse Number], a.add_Street as [Street], a.add_district as [District] from contacts as A, contacts as B');
      ADOQuery1.SQL.Add (' where A.add_street=B.add_street and A.id<>B.id order by a.add_street, a.name_last, a.name_first, a.id');
      ADOQuery1.Parameters.Clear;
      ADOQuery1.Open;
      DBGrid1.Columns.LoadFromFile('C:\No25Data\Text\Grid_DupLastName_Width.txt') ;
      LabPressBtn.Visible:=False;
      LabDupAdd.Visible:=true;
      LabDupName.Visible:=False;
end;
end.
 
Main Duplicates form code  (I've left out the search routine that begins it...)
 
procedure TFormDuplicatesCheck.sBitBtn1Click(Sender: TObject);
begin
    if DataModule1.dtContacts.State in[dsBrowse, dsInsert] then
    begin
    if sMessageDlg ('Are you really sure you want to'+#13+#10'permanently delete this contact?', mtConfirmation,
    [mbYes, mbNo], 0) = mrYes then
    DataModule1.dtContacts.Delete ;
    edSearch.text:='' ;
    end
    else
    DataModule1.dtContacts.Cancel
    end;
procedure TFormDuplicatesCheck.sBitBtn2Click(Sender: TObject);
begin
      close;
end;
procedure TFormDuplicatesCheck.DupLastNameBtnClick(Sender: TObject);
begin
     FormDupLastName.ShowModal;
end;
procedure TFormDuplicatesCheck.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
       DataModule1.dtContacts.Refresh;
end;
end.
[+][-]10/07/08 11:01 AM, ID: 22661862

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 12:25 PM, ID: 22662743

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/08 12:33 PM, ID: 22662817

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 12:35 PM, ID: 22662839

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 01:38 PM, ID: 22663518

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/08 01:47 PM, ID: 22663618

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 01:49 PM, ID: 22663643

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 02:53 PM, ID: 22664270

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/08 02:57 PM, ID: 22664299

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/08 03:02 PM, ID: 22664346

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Delphi Programming
Tags: Delphi, ADO
Sign Up Now!
Solution Provided By: rfwoolf
Participating Experts: 1
Solution Grade: A
 
 
[+][-]10/07/08 03:11 PM, ID: 22664406

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/08 03:14 PM, ID: 22664421

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 03:26 PM, ID: 22664521

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/07/08 03:37 PM, ID: 22664596

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/07/08 03:42 PM, ID: 22664632

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_EXPERT_20070906