Open form, filter on recordID

Creating and using forms

Open form, filter on recordID

Postby ccj.gmr » Sun Mar 04, 2018 9:09 pm

Hi All,
I need help!
1- I can't open a form with a specific "record ID"!
2- How do I do a ".filter" with 3 variables/parameters? articleCode, supplierCode and referenID. Is this possible? The operador is &?
TY for your help.


Code: Select all   Expand viewCollapse view
Sub openDetails()
   Dim prop(1) as New com.sun.star.beans.PropertyValue

   forms = ThisComponent.Parent.getFormDocuments()
   conn = ThisComponent.Parent.DataSource.getConnection("","")

   prop(0).Name="ActiveConnection"
   prop(0).Value=conn
   prop(1).Name="OpenMode"
   prop(1).Value="open"

   oStartForm = ThisComponent.drawpage.forms.MainForm.SubForm
   
   articleCode = oStartForm.columns.getbyName("article code no").getstring
   supplierCode = oStartForm.columns.getbyName("supplier code no").getstring
   referenceID = oStartForm.columns.getbyName("reference ID").getstring
   
   print "article code: " & articleCode & ", supplier code no: " & supplierCode & ",   reference ID: "& referenceID   'OK working fine
   
   oNewDoc = forms.loadComponentFromURL("ARTICLE","_blank",0,prop())
   oNewDocForm = oNewDoc.drawpage.forms.MainForm
   
   IF oNewDocForm.isloaded = false THEN Wait 100 'allows faster CPUs to continue while waiting for slower ones
   oNewDocForm.Last
   oNewDocForm.First 'this along with .Last above leaves the total number of records in nav bar
      
   print "article code: " & articleCode & ", supplier code no: " & supplierCode & ",   reference ID: "& referenceID   'OK working fine

        ' This is not working!!!
   oNewDocForm.Filter = "article code no ='" & articleCode & "'"
   oNewDocForm.ApplyFilter = True
   oNewDocForm.Reload   
End Sub
OpenOffice 4.1.5 on Windows 10
ccj.gmr
 
Posts: 3
Joined: Wed Feb 21, 2018 1:29 am

Re: Open form, filter on recordID

Postby Villeroy » Sun Mar 04, 2018 11:35 pm

Works best without any macro code. Search this forum for "power filtering"
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: 27296
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Open form, filter on recordID

Postby UnklDonald418 » Sun Mar 04, 2018 11:46 pm

Download the example shown here.
Filter/Search with Forms (leveraging SubForms)
it shows an example of filtering using 3 parameters without the brain damage of a macro.
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.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1238
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA


Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests