which would the most appropriate be?

F

Frank Dulk

Function EstaCarregado(ByVal strNomeDoFormulário As String) As Boolean

Const conEstadoObjFechado = 0
Const conModoEstrutura = 0

If SysCmd(acSysCmdGetObjectState, acForm, strNomeDoFormulário) <>
conEstadoObjFechado Then

If Forms(strNomeDoFormulário).CurrentView <> conModoEstrutura Then
EstaCarregado = True
End If
End If
End Function




Há casos, como este, que em vez de percorrer uma coleção para ver se um item
existe ou não, um singelo tratamento de erros pode resolver a questão.

And treating mistakes with it Resume Next!

Function EstáAberto(formulário As String) As Boolean
On Error Resume Next
EstáAberto = (f = Forms(f).Name)
End Function
 
P

Paul Overway

eu nao certo sobre sua pergunta...mas talvez melhor voce escreve tudos em
ingles. ainda eu tentar adjudar

Se voce quer verifcar que um objecto esta aberto, experimenta com esse

Function EstáAberto(NomeDoFormulário As String) As Boolean
Dim f as Form
On Error Resume Next

Set f = Forms(NomeDoFormulário)

EstaAberto = (err.number = 0)

End Function

tchau
 
F

Frank Dulk

Quite so, but which would be better form.

that

Function EstaCarregado(ByVal strNomeDoFormulário As String) As Boolean

Const conEstadoObjFechado = 0
Const conModoEstrutura = 0

If SysCmd(acSysCmdGetObjectState, acForm, strNomeDoFormulário) <>
conEstadoObjFechado Then

If Forms(strNomeDoFormulário).CurrentView <> conModoEstrutura Then
EstaCarregado = True
End If
End If
End Function

or that


There are cases, as this, that instead of traveling a collection to see if
an item
it exists or not, a simple treatment of mistakes can solve the subject.

And treating mistakes with it Resume Next!

Function EstáAberto(formulário As String) As Boolean
On Error Resume Next
EstáAberto = (f = Forms(f).Name)
End Function
 
P

Paul Overway

I like the resume next method better. It is more to the point and I expect
it would be faster as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top