Listboxes on sub/subforms give "ENTER PARAMETER VALUE" on delete from Main Form

Randomblink

The Irreverent Reverend
Local time
Today, 15:15
Joined
Jul 23, 2001
Messages
279
Listboxes on sub/subforms give "ENTER PARAMETER VALUE" on delete from Main Form

Ok... I have three tables...

Table: tbl_Bank
Table: tbl_Bank_Branch
TAble: tbl_Bank_Employees

They are linked as such...

tbl_Bank:bnk_ID
-linked to-
tbl_Bank_Branch:bnk_ID

tbl_Bank_Branch:brnch_ID
-linked to-
tbl_Bank_Employees:brnch_ID

I have created a MAIN FORM: frm_Bank with tbl_Bank as the recordsource. On frm_Bank I have a listbox...
The listbox has a rowsource of:
Code:
SELECT tbl_Bank.bnk_ID, tbl_Bank.bnk_name, tbl_Bank.bnk_add_city, * FROM tbl_Bank ORDER BY tbl_Bank.bnk_name;

I have created a SUB FORM: subfrm_BankBranch with tbl_Bank_Branch as the recordsource. This SUB FORM: subfrm_BankBranch is located AS a SUB FORM, ON the MAIN FORM: frm_Bank.
On subfrm_BankBranch I have a listbox...
The listbox has a rowsource of:
Code:
SELECT tbl_Bank_Branch.brnch_ID, tbl_Bank_Branch.bnk_ID, tbl_Bank_Branch.brnch_name, tbl_Bank_Branch.brnch_pho_main FROM tbl_Bank_Branch WHERE (((tbl_Bank_Branch.bnk_ID)=[Forms]![frm_Bank]![subfrm_BankBranch].[Form]![LinkedField])) ORDER BY tbl_Bank_Branch.brnch_name;

I have created another SUB FORM: subfrm_BankEmployees with tbl_Bank_Employees as the recordsource. This SUB FORM: subfrm_BankEmployees is located AS a SUB FORM, ON the SUB FORM: subfrm_BankBranch.
On subfrm_BankEmployees I have a listbox...
The listbox has a rowsource of:
Code:
SELECT tbl_Bank_Employees.bnk_emp_ID, tbl_Bank_Employees.brnch_ID, [tbl_Bank_Employees].[bnk_emp_l_name] & ", " & [bnk_emp_f_name] AS [Employee Name], tbl_Bank_Employees.bnk_emp_pho_bus, tbl_Bank_Employees.bnk_emp_pho_xt FROM tbl_Bank_Employees WHERE (((tbl_Bank_Employees.brnch_ID)=[Forms]![frm_Bank]![subfrm_BankBranch].[Form]![subfrm_BankEmployees].[Form]![LinkedField])) ORDER BY [tbl_Bank_Employees].[bnk_emp_l_name] & ", " & [bnk_emp_f_name];

The setup is supposed to look as so:

You pick a BANK from the listbox on frm_Bank and UP pops that bank data... Once that Bank has been selected, the listbox on subfrm_BankBranch shows ALL the branches for the selected Bank...
You pick a BRANCH from the listbox on subfrm_BankBranch and UP pops that branch data... Once that Branch has been selected, the listbox on subfrm_BankEmployees shows ALL the Employees for that Branch...
You pick an EMPLOYEE from the listbox on subfrm_BankEmployees and UP pops that employee data...

The PROBLEM I am having is...
If I have this form setup open... and I select a bank...
IF I DELETE that bank, I get "ENTER PARAMETER VALUES" popping up from the rowsources of the subform.listboxes...

What can I do to remove those...?
 
Sounds like you need cascading deletes. If you remove a BANK record, and you do not either manually handle deleting of the associated rows in the other tables, or have cascading deletes setup, you will ophane those rows in the other tables.
As an aside, why don't you link the subforms to the main form via the linking parameters in the form properties themselves?
 
The Forms ARE Linked... The Problem is the LISTBOXES...

The Listboxes are throwing the problems in...
I found a workaround by removing the rowsource of the listboxes... performing the delete actions... reassigning the rowsources to the listboxes... but I ONLY do this for the MAIN FORM: frm_Bank

The subforms are properly linked via Child / Master link fields...
 

Users who are viewing this thread

Back
Top Bottom