Private Sub Command1_Click()
Dim contador As Integer
Dim tabla As TableDef
Dim columna As Field
Dim baseDeDatos As Database
Dim directorioDB As String
Set tabla = baseDeDatos.OpenTable("Empleados")
tabla.AddNew
tabla!Legajo = Text1.Text
tabla.AddNew
tabla!Nombre = Text2.Text
If Text3.Text > 19 And Text3.Text < 51 Then
tabla.AddNew
tabla!Edad = Text3.Text
Label4.Caption = "Terminado"
Else
Label4.Caption = "Registro no cargado. Rango de edad entre 20 y 50 años"
End If
tabla.Update
If contador = 10 Then
Command1.Caption = "Cargados 10 registros"
Else
contador = contador + 1
End If
End Function
Private Sub Form_Load()
Dim tabla As TableDef
Dim columna As Field
Dim baseDeDatos As Database
Dim directorioDB As String
Set archivo = New FileSystemObject
If Not archivo.FileExists("C:\Users\tam45949\Desktop\tp2programacion2.mdb") Then
Set baseDeDatos = DBEngine.Workspaces(0).CreateDatabase("C:\Users\tam45949\Desktop\tp2programacion2.mdb", dbLangSpanish)
End If
Set baseDeDatos = OpenDatabase("C:\Users\tam45949\Desktop\tp2programacion2.mdb")
Set tabla = baseDeDatos.CreateTableDef("Empleados")
Set columna1 = tabla.CreateField("Legajo", dbInteger)
tabla.Fields.Append (columna1)
Set columna2 = tabla.CreateField("Nombre", dbText, 30)
tabla.Fields.Append (columna2)
Set columna3 = tabla.CreateField("Edad", dbInteger)
tabla.Fields.Append (columna3)
baseDeDatos.TableDefs.Append tabla
End Sub
Private Sub Form_Terminate()
tabla.Close
baseDeDatos.Close
End Sub
Link to the library listerreur du compilateur: méthode ou DataMember pas trouvé VB6 (Addnew)
Je ne sais pas quel est le problème avec le code et je cherchai sur le net quelques heures et je peux encore » t trouver la solution. Le problème devrait être dans la fonction Addnew, je suppose qu'il y a une bibliothèque manquante. J'espère que vous pouvez m'aider, je suis nouveau avec v b 6.0. Merci!.
https://msdn.microsoft.com/en-us/library/ee336106(v= office.12) .aspx – Plutonix