Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1
    Utente di HTML.it L'avatar di JCave
    Registrato dal
    Oct 2002
    Messaggi
    132

    [VB6] Errore run time 91

    Ho fatto un programmino semplice che contien un controllo ado con collegamento al DB Access e una datagrid.
    Ho fatto il pacchetto con InnoSetup ma all'avvio della mia apllicazione risulta il seguente errore: Errore di run time 91. Variabile oggetto o variabile del blocco With non impostata.

    Ho visto un po' su internet e ho scoperto che si deve scaricare ed installare il file mdac_typ; l'ho fatto, ho riavviato ma c'è sempre lo stesso errore.
    Uso Win Xp Pro e Win 2003 Server.

    Come posso fare?


  2. #2
    ... per il VB c'è il subforum! sposto là
    ...Terrible warlords, good warlords, and an english song

  3. #3
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Quando si verifica l'errore ?

    Hai individuato (piu' o meno) la parte del codice in cui si manifesta ?

    Puoi mostrare tale parte di codice ...?

  4. #4
    Utente di HTML.it L'avatar di JCave
    Registrato dal
    Oct 2002
    Messaggi
    132
    Scusate, mancavo da un po' e non avevo notato il sub forum.

    L'errore si verifica subito, l'applicazione non parte nemmeno e nel form iniziale c'è già tutto il programma (ado e datagrid)

  5. #5
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    E allora mostra il codice ...

  6. #6
    Utente di HTML.it L'avatar di JCave
    Registrato dal
    Oct 2002
    Messaggi
    132
    codice:
    Option Explicit
    
    Dim NuovoModifica As String
    
    Private Sub cmdEliminaAnnulla_Click()
        If cmdEliminaAnnulla.Caption = "E L I M I N A" Then
            cmdNuovoConferma.Caption = "N U O V O"
            cmdEliminaAnnulla.Caption = "E L I M I N A"
                       
            Dim Elimina1
            Dim Elimina2
            
            Elimina1 = MsgBox("Vuoi eliminare il record corrente?", vbYesNo)
            
            If Elimina1 = vbYes Then
                Elimina2 = MsgBox("Il record corrente sarà eliminato definitivamente.", vbYesNo)
                If Elimina2 = vbYes Then
                    On Error Resume Next
                    adoComuni.Recordset.Delete
                    adoComuni.Recordset.Update
                End If
            End If
        End If
            
        If cmdEliminaAnnulla.Caption = "A N N U L L A" Then
            cmdNuovoConferma.Caption = "N U O V O"
            cmdEliminaAnnulla.Caption = "E L I M I N A"
            
            txtComune.Text = ""
            txtTelefono.Text = ""
            txtFax.Text = ""
            txtNota.Text = ""
            
            txtComune.Locked = True
            txtTelefono.Locked = True
            txtFax.Locked = True
            txtNota.Locked = True
            
            txtComune.SetFocus
        End If
    End Sub
    
    Private Sub cmdModifica_Click()
        NuovoModifica = "M"
                  
        txtComune.Locked = False
        txtTelefono.Locked = False
        txtFax.Locked = False
        txtNota.Locked = False
            
        cmdNuovoConferma.Caption = "C O N F E R M A"
        cmdEliminaAnnulla.Caption = "A N N U L L A"
        cmdModifica.Enabled = False
        
        txtComune.SetFocus
    End Sub
    
    Private Sub cmdNuovoConferma_Click()
        If cmdNuovoConferma.Caption = "N U O V O" Then
            NuovoModifica = "N"
            
            txtComune.Locked = False
            txtTelefono.Locked = False
            txtFax.Locked = False
            txtNota.Locked = False
            
            txtComune.Text = ""
            txtTelefono.Text = ""
            txtFax.Text = ""
            txtNota.Text = ""
        
            cmdNuovoConferma.Caption = "C O N F E R M A"
            cmdEliminaAnnulla.Caption = "A N N U L L A"
            cmdEliminaAnnulla.Enabled = True
            cmdModifica.Enabled = False
            
            txtComune.SetFocus
            
            Exit Sub
        End If
        
        If cmdNuovoConferma.Caption = "C O N F E R M A" Then
            cmdNuovoConferma.Caption = "N U O V O"
            cmdEliminaAnnulla.Caption = "A N N U L L A"
            cmdModifica.Enabled = True
            
            With adoComuni
                If NuovoModifica = "N" Then
                    .Recordset.AddNew
                End If
                
                .Recordset("Comune") = txtComune.Text
                .Recordset("Telefono") = txtTelefono.Text
                .Recordset("Fax") = txtFax.Text
                .Recordset("Nota") = txtNota.Text
                
                .Recordset.Update
                
                dtgComuni.Refresh
            End With
            
            cmdEliminaAnnulla.Caption = "E L I M I N A"
            
            txtComune.Locked = True
            txtTelefono.Locked = True
            txtFax.Locked = True
            txtNota.Locked = True
        End If
    End Sub
    
    Private Sub cmdRimuoviFiltro_Click()
        txtFiltroComune.Text = ""
    End Sub
    
    Private Sub dtgComuni_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
        On Error Resume Next
        txtComune.Text = adoComuni.Recordset("Comune")
        txtTelefono.Text = adoComuni.Recordset("Telefono")
        txtFax.Text = adoComuni.Recordset("Fax")
        txtNota.Text = adoComuni.Recordset("Nota")
        
        adoComuni.Caption = "SONO STATI TROVATI " & adoComuni.Recordset.RecordCount & " COMUNI."
    End Sub
    
    Private Sub Form_Load()
        adoComuni.Caption = "SONO STATI TROVATI " & adoComuni.Recordset.RecordCount & " COMUNI."
    End Sub
    
    Private Sub lblComune_Click()
        adoComuni.Recordset.Sort = "Comune ASC"
    End Sub
    
    Private Sub lblFax_Click()
        adoComuni.Recordset.Sort = "Fax ASC"
    End Sub
    
    Private Sub lblTelefono_Click()
        adoComuni.Recordset.Sort = "Telefono ASC"
    End Sub
    
    Private Sub txtComune_Change()
        If txtComune.Text <> "" Then
            cmdEliminaAnnulla.Enabled = True
            cmdModifica.Enabled = True
        Else
            cmdEliminaAnnulla.Enabled = False
            cmdModifica.Enabled = False
        End If
    End Sub
    
    Private Sub txtFiltroComune_Change()
        adoComuni.Recordset.Filter = adFilterNone
        
        If txtFiltroComune.Text = "" Then
            adoComuni.Recordset.Filter = "Comune <> ''"
        Else
            On Error Resume Next
            adoComuni.Recordset.Filter = "Comune Like '*" & txtFiltroComune.Text & "*'"
        End If
        
        If adoComuni.Recordset.RecordCount = 0 Then
            txtComune.Text = ""
            txtTelefono.Text = ""
            txtFax.Text = ""
            txtNota.Text = ""
        End If
    End Sub

  7. #7
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Devi eliminare la linea nella form_load perche', in quel momento il recordset non esiste.

  8. #8
    Utente di HTML.it L'avatar di JCave
    Registrato dal
    Oct 2002
    Messaggi
    132
    Originariamente inviato da oregon
    Devi eliminare la linea nella form_load perche', in quel momento il recordset non esiste.
    Fatto. La prima schermata parte ma non appena faccio NUOVO e poi CONFERMA mi ridà lo stesso errore.

  9. #9
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Dovrebbe essere

    If NuovoModifica = "N" Then
    .Refresh
    .Recordset.AddNew
    End If

    perche' senza Refresh il recordset non viene creato (a partire dal recordsource, che avrai impostato, penso, con il nome della tabella) ...

    Ma tu l'avevi mai eseguito e testato tutto il programma nell'IDE prima di compilarlo e fare il pacchetto?

  10. #10
    Utente di HTML.it L'avatar di JCave
    Registrato dal
    Oct 2002
    Messaggi
    132
    Sì, nell'ide funziona alla perfezione.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.