[Solved] List Box NULL selection

Creating and using forms

[Solved] List Box NULL selection

Postby DACM » Fri Feb 18, 2011 1:36 am

Okay, I've exhausted my knowledge of Base on this one.

Is there a way to eliminate the NULL selection option with OOo 3.3.0? All my own legacy and newly-created Forms now offer a NULL selection when using OOo 3.3.0 (but not when using OOo 3.1.1). Various .odb creations by others in the forum are hit or miss when opened with OOo 3.3.0. Some exhibit the NULL selection option, while others don't. There's no difference in the List Box or Form settings that I've found. So presuming that some of those downloaded .odb files were created with non-Windows platforms, I'm almost wondering if it's a Windows-specific .odb creation issue. In particular, Villeroy's modelmaker.odb exhibits both options in the same Form! One List Box has the NULL option while the other Table-Control List Box does not. BTW, my own stand-alone Forms DO NOT exhibit this issue; they don't offer the [undesirable] NULL selection option upon Save-As .odt.

Overall, I like the idea, and I certainly wouldn't mind such an option if I could turn it off/on in the Form design, but I can't seem to find such an option or even a workaround. Perhaps this a matter of making each Table-column 'NOT NULL' with SQL? Has anyone else seen this or found a solution? Is it simply a bug?

Here's what I'm seeing:
List_Box_NULL_option_3_1_1.jpg
List Box function without NULL selection option under OOo 3.1.1 (Windows)

List_Box_NULL_option_3_3_0.jpg
List Box function with NULL selection option under OOo 3.3.0 (Windows)

Karaoke.odb
This particular example includes macros, but I'm seeing this issue with/without macros involved.
(40.39 KiB) Downloaded 221 times
Last edited by DACM on Fri Mar 25, 2011 9:13 pm, edited 2 times in total.
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: List Box NULL selection

Postby Villeroy » Fri Feb 18, 2011 2:56 am

It used to be list box property "Input Required" on the data tab. But now it's another thing that stopped working in Base.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26641
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: List Box NULL selection

Postby DACM » Fri Mar 25, 2011 5:23 pm

Here's the workaround I'm currently using:
Code: Select all   Expand viewCollapse view
Sub WhenLoadingFormEvent (oEvent As Object)
   oEvent.Source.GetByName("List Box 1").RemoveItem(0)  'removes the List Box Null selection (overcomes OOo 3.3 bug)
End Sub
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: List Box NULL selection

Postby Villeroy » Fri Mar 25, 2011 7:29 pm

It seems to me as if the null entry depends on the database field beeing nullable or not.
I loaded one of my embedded HSQLDBs download/file.php?id=10524
Removed the relation in the relation manager.
Made the forein key mandatory (not null, entry required=yes).
The form's list box misses the null entry.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, OpenOffice 4.x & LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26641
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: List Box NULL selection

Postby DACM » Fri Mar 25, 2011 8:32 pm

Thanks for taking another look at this Villeroy, but this is beginning to confirm a Windows-build bug in OOo 3.3.0.

I still get the NULL option with your Form:
List_Box_NULL_option_Win7.jpg
Windows 7 64-bit shows the NULL option unless I apply the above macro

List_Box_NULL_option_Win7_macro.jpg
Macro applied to eliminate the NULL option

one_to_many (macro).odb
Added the macro which is evidently necessary with OOo 3.3.0 for Windows
(14.23 KiB) Downloaded 188 times
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: List Box NULL selection

Postby DACM » Fri Mar 25, 2011 8:41 pm

Oh wait a minute...the "entry required = Yes" is set to "No" when opened in Windows.
So maybe that's the only bug if you're sure you set it to "Yes" before uploading the file.

I removed the Relationship, and changed entry required to "Yes", and replaced the relationship...
And it worked!

I'll have to test this further with my other Forms...but thank you!!!
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: List Box NULL selection

Postby DACM » Fri Mar 25, 2011 9:12 pm

I think this is SOLVED!

Villeroy wrote:It used to be list box property "Input Required" on the data tab. But now it's another thing that stopped working in Base.

Correct. The following Form property no longer eliminates the NULL selection option in List Boxes, as it once did in OOo 3.1.1.

List_Box_NULL_option_Form_Input.jpg
The List Box property "Input required" doesn't work


Villeroy wrote:Made the forein key mandatory (not null, entry required=yes).

That's it! :super:

List_Box_NULL_option_Field_Entry.jpg
The associated Table Field property is the solution


So it's the Table Field property, not the Form List Box property that's the critical setting to avoid the NULL entry in List Boxes. I guess that makes some sense, but it probably should work either way. :D

Thanks Villeroy!
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
User avatar
DACM
Volunteer
 
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests