Soy principiante en el manejo de Bases de Datos en VB y quiero hacer una pequeña aplicacion, como capturo, modifico, elimino, etc, datos sin que muestre tantos errores, como clave ya existe, valor nulo, trabajo con Access. Si hay codigo fuente en algun lugar gracias.
Cris20 Hola pega esto en un proyecto nuevo necesitaras 3 Labels 3 Textbox 5 Commandbuttons y un Data Control La base de datos sellama "Biblio" y esta en c:\archivos de programa\Microsoft visual estudio\vb98\Biblio.mdb (Te recomiendo que instales completo el vb6 ! Por todas las rasones del mundo¡ Y para correr este programa.) Los nombres de los controles estan en los "sub" por ejemplo "Private Sub cmdAdd_Click()", el nombre del boton es "cmdAdd" Te diviertes Bye :) Private Sub cmdAdd_Click() Data1.Recordset.AddNew End Sub Private Sub cmdDelete_Click() 'this may produce an error if you delete the last 'record or the only record in the recordset Data1.Recordset.Delete Data1.Recordset.MoveNext End Sub Private Sub cmdRefresh_Click() 'this is really only needed for multi user apps Data1.Refresh End Sub Private Sub cmdUpdate_Click() Data1.UpdateRecord Data1.Recordset.Bookmark = Data1.Recordset.LastModified End Sub Private Sub cmdClose_Click() Unload Me End Sub Private Sub Data1_Error(DataErr As Integer, Response As Integer) 'This is where you would put error handling code 'If you want to ignore errors, comment out the next line 'If you want to trap them, add code here to handle them MsgBox "Data error event hit err:" & Error$(DataErr) Response = 0 'throw away the error End Sub Private Sub Data1_Reposition() Screen.MousePointer = vbDefault On Error Resume Next 'This will display the current record position 'for dynasets and snapshots Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1) 'for the table object you must set the index property when 'the recordset gets created and use the following line 'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1 End Sub Private Sub Data1_Validate(Action As Integer, Save As Integer) 'This is where you put validation code 'This event gets called when the following actions occur Select Case Action Case vbDataActionMoveFirst Case vbDataActionMovePrevious Case vbDataActionMoveNext Case vbDataActionMoveLast Case vbDataActionAddNew Case vbDataActionUpdate Case vbDataActionDelete Case vbDataActionFind Case vbDataActionBookmark Case vbDataActionClose End Select Screen.MousePointer = vbHourglass End Sub