Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'função para verificar se algum usuário está gerando fatura (para não gerar número de fatura duplicado)
- Function verificaGeraFaturaAberto()
- On Error GoTo erro
- Dim Rec113 As ADODB.Recordset
- Call Conectar
- 'seleciona os regitros da tabela ger113
- Set Rec113 = New ADODB.Recordset
- Rec113.Open "SELECT * FROM ger113 WHERE Estado = true AND datevalue(data) = '" & DateValue(dataAberturaForm) & "'", con, adOpenStatic, adLockReadOnly
- 'caso recordcount maior que zero entra no loop
- Do While Rec113.RecordCount > 0
- 'fecha a conexao e abre novamente
- Rec113.Close
- Rec113.Open "SELECT * FROM ger113 WHERE Estado = true AND datevalue(data) = '" & DateValue(dataAberturaForm) & "'", con, adOpenStatic, adLockReadOnly
- 'caso recordcount igual a 0 sai do loop para gerar um novo numero de fatura sem duplicar
- If Rec113.RecordCount = 0 Then
- Exit Function
- End If
- Loop
- Call Desconectar
- Exit Function
- erro:
- GravaErro err.Description, "verificaGeraFaturaAberto : frmAgendaVis"
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement