First of all apologies about my naming of things here. I’m used to Access where a form is a form and a form within a form is a subform!
I have 2 forms on a document (? I’d call it a form in Access) which are basically 2 listboxes. The 2nd listbox contains rows/records to related to the row/record in the first listbox.
My form is based on the example in this post Using multiple listboxes which was my first question about how to achieve the above (listbox populating 2nd listbox). I don’t display results of the second listbox as per the example. All I’m interested in is the what’s in the filter table which should be the id from the first and second listboxes. The example shows two buttons that the user has to click after the 1st and 2nd selections from each listbox. They both have the action “refresh”. I want to replace the buttons with an event macro that does a “refresh” when the listbox changes. I have done this sort of thing before when I had a mainform and subform and it seemed to work OK. This however is not he case with 2 (main?) forms on the document itself.
Before I continue. Is it important where the “refresh buttons” are? In the example they are on InvSelect form, and on something called a mainform which looks like a subform below InvSelect? This may have some bearing on what I’m supposed to refresh in the macro.
As stated before my doc (ument?) has 2 forms on it. The CustomerSelect and the InvoiceSelect forms. Each form has a listbox the CustomerListBox and yes you’ve guessed it the InvoiceListBox. To try and prove things are working I have 2 text boxes containing the CustomerID and InvoiceID from the filter table (txtCustFilter and txtInvFilter). These are currently on the CustomerSelect form. They didn’t work at all elsewhere (InvoiceSelect). I’m not sure where I’m up to but I’ve used various variations of the following for both Customer and the Invoice equivalent. It seems to (half) work for the customer in as much as the txtCustFilter gets updated on the document but not in the filter table itself (yes I did a manual refresh when looking).
The variations are
oForm = ThisComponent.Drawpage.Forms.getByName("CustomerSelect") oList = oForm.getByName("CustomerListBox") oList.commit() olist.refresh
I’m pretty sure when I used it on another form to play around with oForm.reload worked perfectly but here it doesn’t at all.
Incidentally the invoice listbox seems 1 step behind.
So for example if I have have
Cust1 with Inv1 and Inv1a and Inv1b
Cust2 with Inv2
Cust3 with Inv3 and Inv3a
Let’s say the selection is on Cust1 and I change to Cust2 I see in the second listbox Inv1 and Inv1a and Inv1b. If I then select Cust3 I get Inv2 etc.
Another thing was when I started the Cust1 record had an (automatically generated) id of zero. If I was on Cust2 and chose Cust1 it would flip back to Cust2. If I chose Cust1 again it would be OK. This only ever was a problem with Cust1. I Eventually changed the id (manually) from 0 to 6 (making necessary changes to Invoice records as well) and everything is OK as far as that is concerned. Any ideas what was happening there. I know I’ve probably broken the too many question thing but this is all pertaining to one problem. I can split if deemed necessary.
Version: 22.214.171.124 (x64)
Build ID: 64390860c6cd0aca4beafafcfd84613dd9dfb63a
CPU threads: 2; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
HSQL Version 1.8