| View previous topic :: View next topic |
| Author |
Message |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Wed May 25, 2011 1:08 am Post subject: |
|
|
=HYPERLINK(".uno:refreshDataArea";"Click MyText") placed somwhere near the linked range updates the import range.
Click a single cell within the range, then click the hyperlink text.
Same thing works with a hyperlink button.
This macro updates all database ranges within the current document:
| Code: |
sub refreshAllDBRanges
e=ThisComponent.DatabaseRanges.createEnumeration()
while e.hasMoreElements()
dbr=e.nextElement()
dbr.refresh()
wend
end sub
|
_________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
pamac General User

Joined: 11 Mar 2011 Posts: 17
|
Posted: Mon May 30, 2011 7:33 am Post subject: |
|
|
Hi,
I have been working on a different project for the past few days so i havent had much time to clean up this form.
I have started to look into the form today and I have another question.
With my list boxes I have implemented the MySQL queries as follows:
| Code: |
SELECT DISTINCT "UNIT","UNIT" FROM "Table1" AS "A",
(SELECT * FROM "filter" AS "B"
WHERE "B"."ID" = 0
) AS "B"
WHERE ("A"."User_ID" = "B"."cUID" OR "B"."cUID" is NULL)
AND ("A"."Comment" = "B"."cComment" OR "B"."cComment" is NULL)
|
This query works fine but requires a refresh form to run the query again if any values have changed.
I have tried a button on my MAIN form (which works) but i get a popup to save any changes to my subform.
If i update my subform first, then update my main form there is no popup but requires multiple button presses.
Can anyone recommend a way to refresh my form, preferably when a value in a listbox is changed all others are refreshed.
Thanks in advance,
Pamac |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Mon May 30, 2011 8:58 am Post subject: |
|
|
First of all, the filter form needs to be saved which happens automatically when you tab out of the form or when you hit some save button.
Macro to save current filter form and refresh database range, mostly recorded by the MRI tool:
| Code: |
Sub Snippet(Optional oInitialTarget As Object)
Dim oSource As Object
Dim oModel As Object
Dim oParent As Object
Dim oParent_2 As Object
Dim oParent_3 As Object
Dim oDatabaseRanges As Object
oSource = oInitialTarget.Source
oModel = oSource.Model
sDB=oModel.Tag
oParent = oModel.Parent
oParent.updateRow()
oParent_2 = oParent.getParent()
oParent_3 = oParent_2.Parent
oDatabaseRanges = oParent_3.DatabaseRanges
oDatabaseRange=oDatabaseRanges.getByName(sDB)
oDatabaseRange.refresh()
End Sub
|
Attach a button to the filter form.
"Action" = None
"Additional Information" = Name of your import range.
"Default Button" = Yes so it reacts on the Enter key.
Bind the button's execution event to the above macro. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
|