Recent

Author Topic: DBLookupComoboBox that update second DBLookupComoboBox  (Read 1941 times)

fiazhnd

  • New Member
  • *
  • Posts: 36
DBLookupComoboBox that update second DBLookupComoboBox
« on: August 06, 2017, 01:01:45 pm »
I was reading this topic http://forum.lazarus.freepascal.org/index.php?topic=28939.0

I have DBLookupComoboBox 1 and 2 and i am using MS Access. my two table name is

tcustomer table
CusID -PK
Name

tcustomercar table
CCarID -PK
CusID -FK
Car

SqlQuery1 (Select*from tcustomer) SqlQuery2(Select*from tcustomercar)


I want when a user selects one customer name in ComoboBox1 it update the ComboBox2 and show only those car which related to selected customer.

fiazhnd

  • New Member
  • *
  • Posts: 36
Re: DBLookupComoboBox that update second DBLookupComoboBox
« Reply #1 on: August 08, 2017, 08:55:12 am »
Problem solved.

I use two comboBox one on form showevent to load required data from database second one to load data (by using SQL query) on based on first combobox selection. However, i use Combobox2.Items.Addobject which help me to save Foreign Key to my 3rd table.

mangakissa

  • Hero Member
  • *****
  • Posts: 1131
Re: DBLookupComoboBox that update second DBLookupComoboBox
« Reply #2 on: August 08, 2017, 01:20:53 pm »
refresh or open/close the lookuptable. This results in a new dataset for the DBLookupcombobox.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

 

TinyPortal © 2005-2018