1 (edited by ktommy 2022-08-21 15:19:47)

Topic: Combobox1 not updating combobox2

Hello once again,

I attach a sample of my project where I want to collect calls based on a customer and an administrator that gives the call from the customer. Although I connected both of the combobox1 (corresponds to customers) and combobox2 (corresponds to administrators that are related to the customers) and (hopefully created correctly the relationships between those tables), the combobox2 is empty at calls form no matter which customer I'm picking. I made all the checkups and make sure that the customers are connected with its corresponding administrator but for some reason it's not working.

Thank you for any help.

Post's attachments

Attachment icon Relationships_New.zip 339.96 kb, 95 downloads since 2022-08-21 

Re: Combobox1 not updating combobox2

Hi,


If you are trying to use ParentComboBox, then you are missing entries in the administrators table.
All id_customers fields are NULL.
The work is described in detail
http://myvisualdatabase.com/help_en/pro … boBox.html

Post's attachments

Attachment icon adm.jpg 16.65 kb, 53 downloads since 2022-08-21 

Re: Combobox1 not updating combobox2

procedure addcall_OnShow (Sender: TObject; Action: string);
begin
  addcall.ComboBox2.dbUpdate;
end;
Post's attachments

Attachment icon Relationships_New.rar 6.04 kb, 102 downloads since 2022-08-21 

Re: Combobox1 not updating combobox2

pavlenko.vladimir.v wrote:
procedure addcall_OnShow (Sender: TObject; Action: string);
begin
  addcall.ComboBox2.dbUpdate;
end;

This is a false solution for ParentComboBox.
This solution will not allow related records to be displayed.
In addition, when selected in Combo1, Combo2 will be reset.

5 (edited by ktommy 2022-08-21 18:45:34)

Re: Combobox1 not updating combobox2

Hello everyone and thank you for all your help.

Sparrow, yes I did this as you mentioned and I created this based on a template from countries and cities replacing the actual tables with a different names and keeping the format and settings.
Vladimir your code was what I had in mind and I tried that as well but for some reason I was experiencing an unusual error. And thanks to both of you I found where was the problem. The issue was on a grid that was on a second form that was creating a bug and creating ghost entries. Once I deleted it and wiped out all data and re enter the data everything was working like charm.

Thank you for all your help.

6 (edited by pavlenko.vladimir.v 2022-08-21 18:58:43)

Re: Combobox1 not updating combobox2

sparrow wrote:
pavlenko.vladimir.v wrote:
procedure addcall_OnShow (Sender: TObject; Action: string);
begin
  addcall.ComboBox2.dbUpdate;
end;

This is a false solution for ParentComboBox.
This solution will not allow related records to be displayed.
In addition, when selected in Combo1, Combo2 will be reset.

В данном проекте такая связь - это лишнее

ParentCombobox - предназначен для связей  к примеру :::  Страна-Город-Улица или Компания-Имя-Должнасть
тут же нужно выбрать клиента и назначить ему админимстратора
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=8957&download=0

Post's attachments

Attachment icon Без имени.png 101.12 kb, 53 downloads since 2022-08-21