Sub sBotonAbreConsulta(Evento As Object) REM - Poner esta macro en el botón para que llame a la otra
Dim sNombreC As String
sNombreC=Evento.Source.Model.Tag REM - En el Tag del boton (propiedad información adicional) poner el nombre de la Consulta
sAbreConsulta(sNombreC,ThisDatabaseDocument.Currentcontroller.ActiveConnection)
End Sub
Sub sAbreConsulta(sNombreC As String,Con As Object)
Dim oDes
Dim sURL As New com.sun.star.util.URL
Dim oDisObj
Dim oProps(5) As New com.sun.star.beans.PropertyValue
oDes=CreateUnoService("com.sun.star.frame.Desktop")
sURL.Complete=".component:DB/DataSourceBrowser"
oDisObj=oDes.QueryDispatch(sURL,"_Blank",com.sun.star.frame.FrameSearchFlag.CREATE)
oProps(0).Name="ActiveConnection"
oProps(0).Value=Con
oProps(1).Name="CommandType"
oProps(1).Value=com.sun.star.sdb.CommandType.QUERY
oProps(2).Name="Command"
oProps(2).Value=sNombreC
oProps(3).Name="ShowMenu"
oProps(3).Value=True
oProps(4).Name="ShowTreeView"
oProps(4).Value=FALSE
oProps(5).Name="ShowTreeViewButton"
oProps(5).Value=FALSE
oDisObj.Dispatch(sURL,oProps)
End Sub
Sub AbrirFormulario()'evento botón
ThisDatabaseDocument.FormDocuments.GetByName("NombreFormulario").Open
End Sub
Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 6 invitados