MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

https://www.maximoaccess.com/t48-regras-do-forum

Obrigado

Administração


Participe do fórum, é rápido e fácil

MaximoAccess

Caro Usuário, antes de postar pela primeira vez, leia as regras do fórum.

https://www.maximoaccess.com/t48-regras-do-forum

Obrigado

Administração

MaximoAccess

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Dicas Ms Access, Exemplos Ms Access, Codigos VBA Ms Access, SQL Ms Access


2 participantes

    Abrir fomulario e depois executar som .wav

    avatar
    mauriiciol
    Novato
    Novato


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 4
    Registrado : 24/08/2013

    Abrir fomulario e depois executar som .wav Empty Abrir fomulario e depois executar som .wav

    Mensagem  mauriiciol 20/9/2016, 19:52

    Pessoal,
    boa tarde.

    Estou com uma duvida, criei um formulário para aviso(com som .wav) em tela onde a tela frmTestaSons ao abrir esta executando primeiro o som para depois abrir o formulario, ja tentei quase de todas as formas, para deixar q primeiro abra o formulario e depois execurar o som.
    Segue o codigo que estou utilizando:

    Private Sub Form_Load()
    Me.Lida = True
    Me.Imagem11.Picture = CurrentProject.Path & "\Imagem\" & Me.OPERADOR & ".jpg"
    PlaySound CurrentProject.Path & "\sons\" & Me!OPERADOR & ".wav", 1, 1
    Call Sleep(1700)
    DoEvents
    If DLookup("parte2", "tblNumeros", "parte0=" & Me!somanumero) = "x" Then
    PlaySound CurrentProject.Path & "\sons\" & DLookup("parte1", "tblnumeros", "parte0=" & somanumero) & ".wav", 1, 1
    Call Sleep(1000)
    Else
    PlaySound CurrentProject.Path & "\sons\" & DLookup("parte1", "tblnumeros", "parte0=" & somanumero) & ".wav", 1, 1
    End If
    End Sub

    voces conseguem me ajudar?
    Marco Messa
    Marco Messa
    Developer
    Developer


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 291
    Registrado : 28/06/2010

    Abrir fomulario e depois executar som .wav Empty Re: Abrir fomulario e depois executar som .wav

    Mensagem  Marco Messa 21/9/2016, 21:00

    Utilize o evento Timer do formulário, que irá executar efetivamente após a abertura.

    Código:

    Private Sub Form_Load()
      Me.Lida = True
      Me.Imagem11.Picture = CurrentProject.Path & "\Imagem\" & Me.OPERADOR & ".jpg"
      Me.TimerInterval = 500
    End Sub

    Private Sub Form_Timer()
      PlaySound CurrentProject.Path & "\sons\" & Me!OPERADOR & ".wav", 1, 1
      Call Sleep(1700)
      
      DoEvents
      
      If DLookup("parte2", "tblNumeros", "parte0=" & Me!somanumero) = "x" Then
        PlaySound CurrentProject.Path & "\sons\" & DLookup("parte1", "tblnumeros", "parte0=" & somanumero) & ".wav", 1, 1
        Call Sleep(1000)
      Else
        PlaySound CurrentProject.Path & "\sons\" & DLookup("parte1", "tblnumeros", "parte0=" & somanumero) & ".wav", 1, 1
      End If

      'Para não toque o som novamente
      Me.TimerInterval = 0
    End Sub


    .................................................................................
    Tea with me that I book your face Cool
    avatar
    mauriiciol
    Novato
    Novato


    Respeito às regras : Respeito às Regras 100%

    Sexo : Masculino
    Localização : Brasil
    Mensagens : 4
    Registrado : 24/08/2013

    Abrir fomulario e depois executar som .wav Empty Re: Abrir fomulario e depois executar som .wav

    Mensagem  mauriiciol 29/9/2016, 15:33

    Essa parte ficou otimo amigo, porem apareceu um erro em outro formulario, pois ele tambem tem "Private Sub Form_Timer()", e apareceu o seguinte erro conforme imagem: A expressão No timer que voce inseriu como definição da propriedade de evento gerou o seguinte erro: Rturn sem GoSub.

    Segue abaixo o codigo que esta no timer:
    Private Sub Form_Timer()
    Me.txtHora.Value = Time()

    Dim actDate As String, itemDate As String
    Dim actTime As String, itemTime As String
    Dim itemObs As String
    Dim currIdx As Integer
    Dim actID As Integer

    actDate = txtData
    actTime = txtHora

    For currIdx = 0 To List0.ListCount - 1
    If currIdx > List0.ListCount - 1 Then Exit For
    If List0.ListCount <= 0 Then Exit For
    List0.BoundColumn = 1
    If IsNull(List0.ItemData(currIdx)) Then Exit For
    actID = List0.ItemData(currIdx)
    List0.BoundColumn = 2
    itemDate = List0.ItemData(currIdx)
    List0.BoundColumn = 3
    itemTime = List0.ItemData(currIdx)
    List0.BoundColumn = 4
    itemObs = List0.ItemData(currIdx)

    If CDate(actDate) >= CDate(itemDate) Then
    If CDate(actTime) >= CDate(itemTime) Then
    DoCmd.OpenForm "frmTestaSons", acNormal, , , , , actID
    Exit For
    End If
    End If
    Next currIdx
    Me.List0.Requery
    End Sub

    Conteúdo patrocinado


    Abrir fomulario e depois executar som .wav Empty Re: Abrir fomulario e depois executar som .wav

    Mensagem  Conteúdo patrocinado


      Data/hora atual: 26/4/2024, 15:52