Denunciar Run-time Error '91': em Visual Basic Postado Julho 18, 2007 Run-time error '91': Object variable or With block variable not setCódigo:Private Sub SlPreencheCombo() Dim cSel As String Dim SsPesquisa As Recordset cSel = "SELECT DISTINCT * FROM USUARIO_SISTEMA " & _ "ORDER BY NOME_USUARIO" '"WHERE NOT LOGON " & _ Set SsPesquisa = Restaurante_DB.OpenRecordset(cSel, dbOpenSnapshot) If SsPesquisa.RecordCount > 0 Then SsPesquisa.MoveFirst Do While Not SsPesquisa.EOF Combo_Usuario.AddItem SsPesquisa!NOME_USUARIO SsPesquisa.MoveNext Loop Else Combo_Usuario.Enabled = False MsgBox "Não há nenhum usuário cadastrado no sistema! " & Chr(10) & _ "Favor entrar com a senha padrão do sistema.", _ vbInformation, "Atenção" TxtSenha_GotFocus End If End Sub
Run-time Error '91':
em Visual Basic
Postado
Run-time error '91': Object variable or With block variable not set
Código:
Private Sub SlPreencheCombo()
Dim cSel As String
Dim SsPesquisa As Recordset
cSel = "SELECT DISTINCT * FROM USUARIO_SISTEMA " & _
"ORDER BY NOME_USUARIO"
'"WHERE NOT LOGON " & _
Set SsPesquisa = Restaurante_DB.OpenRecordset(cSel, dbOpenSnapshot)
If SsPesquisa.RecordCount > 0 Then
SsPesquisa.MoveFirst
Do While Not SsPesquisa.EOF
Combo_Usuario.AddItem SsPesquisa!NOME_USUARIO
SsPesquisa.MoveNext
Loop
Else
Combo_Usuario.Enabled = False
MsgBox "Não há nenhum usuário cadastrado no sistema! " & Chr(10) & _
"Favor entrar com a senha padrão do sistema.", _
vbInformation, "Atenção"
TxtSenha_GotFocus
End If
End Sub