Listbox Updating 2 fields, possible?

Creating and using forms

Listbox Updating 2 fields, possible?

Postby Maax555 » Mon Jun 04, 2018 5:34 pm

Hi, I have a form with with a listbox to enter a status. The listbox updates the statusID correctly and details are saved as they should be.
However i also would like the StatusDesc updating at the same time so the user has a better idea of which status to choose.
I have a table which only has StatusID, StatusName and StatusDesc.
Is it possible for the StatusName listbox to bring in the StatusDesc at the same time?

many thanks
Last edited by Maax555 on Tue Jun 05, 2018 3:25 pm, edited 2 times in total.
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
Maax555
 
Posts: 127
Joined: Tue Mar 28, 2017 11:56 am

Re: Listbox Updating 2 fields, possible?

Postby UnklDonald418 » Mon Jun 04, 2018 6:41 pm

For your list box query try something like
Code: Select all   Expand viewCollapse view
SELECT "StatusName" || ' - ' || "StatusDesc", "StatusID" FROM "YourTable"
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.7 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1262
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Listbox Updating 2 fields, possible?

Postby Maax555 » Tue Jun 05, 2018 9:43 am

thanks UNK, however i was wanting the description to appear in a separate field so i could place this anywhere on the form.
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
Maax555
 
Posts: 127
Joined: Tue Mar 28, 2017 11:56 am

[SOLVED} Listbox Updating 2 fields, possible?

Postby Maax555 » Tue Jun 05, 2018 9:56 am

I have managed to solve this myself thanks to previous advice on subforms and a macro to refresh.
I moved the StatusDesc to a subform, linked the subform StatusID and added a macro to refresh the form as soon as the listbox was updated.
A very simple process but only able to do this as a result of the great help received on these forums.
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
Maax555
 
Posts: 127
Joined: Tue Mar 28, 2017 11:56 am

Re: Listbox Updating 2 fields, possible?

Postby Maax555 » Tue Jun 05, 2018 3:27 pm

Spoke too soon. The refresh is refreshing the main form. As soon as i update the listbox the refresh takes the form back to a previous record.
I need to work out a macro to only refresh the RefreshSubform I think?

:-(
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
Maax555
 
Posts: 127
Joined: Tue Mar 28, 2017 11:56 am

Re: Listbox Updating 2 fields, possible?

Postby Villeroy » Tue Jun 05, 2018 3:54 pm

You can refresh the subform on the navigation toolbar when some subform element has the focus.
When a list box or combo box is foussed, you can use the second refresh button to refresh the list of the selected element.
Instead of the navigation toolbar, you can attach a navigation control to the subform. Use the form navigator to make sure that it belongs to the right subform.
Instead of any of these toolbars, you can attach a push button with action "Refresh form".
It might be possible to create a refresh button for a list/combo box by using an URL button with the right dispatch URL.

Dozends of refresh macros have been written over the years.
This is my version of a universal refresh macro triggered by a form event: https://forum.openoffice.org/en/forum/v ... 21&t=88831 to refresh any (group of) forms/combos/lists after the current record has been removed/updated/inserted
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27380
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Listbox Updating 2 fields, possible?

Postby Maax555 » Tue Jun 05, 2018 4:49 pm

many thanks, i will have to study this carefully in all honesty its a little beyond me. It is a macro I prefer as I have avoided manual refreshing thus far.
I will for now add a manual push button to refresh so i can keep moving forward with my current form i am working on.

thanks
Regards Maax
LibreOffice 6.1.4.2 on Windows 7
Maax555
 
Posts: 127
Joined: Tue Mar 28, 2017 11:56 am

Re: Listbox Updating 2 fields, possible?

Postby Villeroy » Tue Jun 05, 2018 8:44 pm

Villeroy wrote:It might be possible to create a refresh button for a list/combo box by using an URL button with the right dispatch URL.

Push button properties:
1) Take focus on click = No since we want to refresh the focussed list/combo
2) Action = "Open Document or URL"
3) URL = .uno:RefreshFormControl
this is the dispatch URL behind the second refresh button on the navi toolbar.

Refreshing a subform does not require any such trick because there is action "Refresh form"
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27380
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests