referring to the active project
Hi!
I am a student who is writing her Thesis. And I need to program a button in Manifold (I do not know whether have you heard about this program before. It is a G.I.S. one).
The aim of this button is to show the result of a SQL query. And this part I got. What I need to get now is, since this button appears everytime you lunch the programm by default. And if the project where the query and tables needed is not the current one it leads to an error. Then I need the button to get which is the active project and if this is not the right one, then display a box and do not execute the query.
But, as I do not have so much knowledge about programming, I do not know how to make the script get the active project name and then, if it is not the right one,display the box.
Here you have the button programmation just in case you want to have a look at it :)
Sub Main
Set doc = Application.ActiveDocument
set project = doc.Name
if project <> "Copia de room" then
MsgBox " Necesitas abrir el proyecto"
exit sub
end if
set Comps = Document.ComponentSet
if Comps.ItemByName ("kk")< False then
set Qry = Document.NewQuery ("New Query")
else
set Qry = Comps.Item ("kk")
end if
Qry.Text = "select [Rooms].[room_name],[places],[Rooms].[Use],[user],[Address].[street] from [Rooms]" &_
"inner join [Room]" &_
"inner join [Address]" & " on [Room].[building] = [Address].[building]" &_
"on [Rooms].[room_name] = [Room].[room_id]" &_
"where [places]>30 and [places]<100"
Qry.RunEx True
set table = Qry.Table
Qry.Table.Open
End Sub
where "Copia de room" is the project name containing the query and tables.
Thank you very much!!
Arantxa
|