OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[Solved]Macro needed or not?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Wed May 25, 2011 1:08 am    Post subject: Reply with quote

=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 https://forum.openoffice.org
Back to top
View user's profile Send private message
pamac
General User
General User


Joined: 11 Mar 2011
Posts: 17

PostPosted: Mon May 30, 2011 7:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Mon May 30, 2011 8:58 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group