[Solved] ListBox entry locks record

Discuss the database features

[Solved] ListBox entry locks record

Postby David Lake » Mon Sep 05, 2011 1:28 pm

I have included a ListBox on a Form, but when I select anything from the list, the record locks and I can't move on to add another record.
Last edited by David Lake on Mon Sep 12, 2011 1:46 pm, edited 1 time in total.
OpenOffice 3.3 on Windows Vista
David Lake
 
Posts: 2
Joined: Mon Sep 05, 2011 1:19 pm

Re: ListBox entry locks record

Postby Villeroy » Mon Sep 05, 2011 1:47 pm

You try to insert a duplicate into a field that is set up to not accept duplicates.
You try to insert a wrong data type or null where null is not allowed.

Normally you use list boxes to avoid all errors related to referencial integrity.
[Example] Relations reflected by list boxes in forms
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29697
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: ListBox entry locks record

Postby David Lake » Wed Sep 07, 2011 11:11 am

Neither of these apply. The drop down is a foreign key field defined exactly as its related primary key. The correct values are displayed in the listbox, but the record locks.
OpenOffice 3.3 on Windows Vista
David Lake
 
Posts: 2
Joined: Mon Sep 05, 2011 1:19 pm

Re: ListBox entry locks record

Postby Villeroy » Wed Sep 07, 2011 11:40 am

David Lake wrote:Neither of these apply. The drop down is a foreign key field defined exactly as its related primary key. The correct values are displayed in the listbox, but the record locks.

But the displayed value is not the foreign key value the listbox is going to write into the field. There is always a hidden second field behind the displayed ones.

This is how a list box can be fabricated to work with a visible field content and a foreign key:
Data Field: the table's foreign key
Input required: if nullable
Type of content: SQL
Content: SELECT "Visible_Field", "Other_Tables_PrimaryKey" FROM "Other_Table" ORDER BY "Visible_Field" ASC
Bound field: 1 [which is the 2nd field since #0 is the visible one. Yes, it's crazy]

Debug tip: Enter the same values you are trying to enter in the form directly into the underlying table or query respectively. Quite often this helps to understand why things go wrong.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29697
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Base

Who is online

Users browsing this forum: No registered users and 6 guests