I realize this has been asked a few times, but I don't think I've ever seen the full explanation of how this is done...
I want to use a form with a button on it that will not only open another form, but determine the new form's query.
In essence, I want to use the source form's data to determine what some of the criteria is for the destination (the new) form's query.
Can this be done? And if so, how?
The answer to this will probably determine if I can accomplish the goals I have in mind with using Base as a replacement for MS Access. I'm a Linux user and I want to get as far away from MS as possible.
Anyone's help in this matter is EXTREMELY appreciated.
Thanks...
Using a button to open a new form (plus determine its query)
Using a button to open a new form (plus determine its query)
OOo 2.3.X on PCLinuxOS
-
- Volunteer
- Posts: 283
- Joined: Tue Dec 04, 2007 6:38 pm
- Location: Houston, TX
Re: Using a button to open a new form (plus determine its query)
In addition to steps to open form, supply a filter string. Here is an example:
Code: Select all
Sub openForm(FormName As String,Connection As Object,Optional Filter As String, Optional FormToFilter As Integer, Optional GotoRec As Integer)
Dim FormDoc As Object
Dim Form As Object
Dim FormDocs As Object
Dim Args(1) As New com.sun.star.beans.PropertyValue
FormDocs=Connection.Parent.DatabaseDocument.FormDocuments
If IsMissing(Filter) Then
Filter=""
End If
If IsMissing(FormToFilter) Then
FormToFilter=0
End If
If IsMissing(GotoRec) Then
GotoRec=-1
End If
Args(0).Name="ActiveConnection" : Args(0).Value=Connection
Args(1).Name="OpenMode" : Args(1).Value="open"
FormDoc=FormDocs.loadComponentFromURL(FormName,"_blank",0,Args())
If Filter<>"" Or GotoRec>=0 Then
Form=FormDoc.DrawPage.Forms.getByIndex(FormToFilter)
End If
If Filter<>"" Then
Form.Filter=Filter
Form.ApplyFilter=True
End If
If GotoRec>=0 Then
Form.load()
If GotoRec=0 Then
Form.moveToInsertRow()
Else
Form.absolute(GotoRec)
End If
End If
End Sub
Re: Using a button to open a new form (plus determine its query)
Just a side-note:
May be 5 years from now.... Base as a replacement for MS Access.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice