AYUDENME A DEFINIR O CORREGIR ESTA VARIABLE
Publicado por Boris (5 intervenciones) el 23/06/2005 16:39:39
Amigos por favor ayudenme en esto, he credo codigo para poder leer informacion de una base de datos de foxpro,pero cuando lo ejecuto me indica error
Error de compilacion
No se a definido el tipo definido por el usuario
en el codigo :
Dim ws As Workspace
estoy queriendo hacer en objeto de acceso en datos DAO
parte del codigo es el sgte:
Dim ws As Workspace
Dim bd As Database
Dim reg As Recordset
Private Sub Form_Load()
Set ws = DBEngine.Workspaces(0)
Set bd = ws.OpenDatabase("d:\Registro", False, False, "Foxpro 2.6;")
Set reg = bd.OpenRecordset("Registro", dbOpenDynaset)
Datos
CmdGrabar.Enabled = False
End Sub
Private Sub Datos()
If reg.EOF Then Exit Sub
If reg.BOF Then Exit Sub
TxtCodigo.Text = IIf(IsNull(reg!Copar), "", reg!Copar)
TxtApellidos.Text = IIf(IsNull(reg!Apell), "", reg!Apell)
TxtNombres.Text = IIf(IsNull(reg!Nombr), "", reg!Nombr)
TxtDni.Text = IIf(IsNull(reg!Lepar), "", Str$(reg!Lepar))
TxtLugar.Text = IIf(IsNull(reg!Lupar), "", reg!Lupar)
TxtFechaN.Text = IIf(IsNull(reg!Fnpar), "", reg!Fnpar)
TxtTele.Text = IIf(IsNull(reg!Tepar), "", Str$(reg!Tepar))
TxtDomicilio.Text = IIf(IsNull(reg!Dopar), "", reg!Dopar)
TxtReferencia.Text = IIf(IsNull(reg!Repar), "", reg!Repar)
TxtTelefono.Text = IIf(IsNull(reg!Trpar), "", Str$(reg!Trpar))
Txtcurso.Text = IIf(IsNull(reg!Nomcu), "", reg!Nomcu)
Txtcodig.Text = IIf(IsNull(reg!Codig), "", Str$(reg!Codig))
TxtHoras.Text = IIf(IsNull(reg!Horas), "", Str$(reg!Horas))
End Sub
Private Sub CmdGrabar_Click()
reg!Copar = RTrim$(TxtCodigo.Text)
reg!Apell = RTrim$(TxtApellidos.Text)
reg!Nombr = RTrim$(TxtNombres.Text)
reg!Lepar = RTrim$(TxtDni.Text)
reg!Lupar = RTrim$(TxtLugar.Text)
reg!Fnpar = RTrim$(TxtFechaN.Text)
reg!Tepar = RTrim$(TxtTele.Text)
reg!Dopar = RTrim$(TxtDomicilio.Text)
reg!Repar = RTrim$(TxtReferencia.Text)
reg!Trpar = RTrim$(TxtTelefono.Text)
reg!Nomcu = RTrim$(Txtcurso.Text)
reg!Codig = RTrim$(Txtcodig.Text)
reg!Horas = RTrim$(TxtHoras.Text)
If MsgBox("Desea Grabar el registro?", 4 + 32 + 256, "grabar") = 6 Then
reg.Update
End If
CmdGrabar.Enabled = False
End Sub
Error de compilacion
No se a definido el tipo definido por el usuario
en el codigo :
Dim ws As Workspace
estoy queriendo hacer en objeto de acceso en datos DAO
parte del codigo es el sgte:
Dim ws As Workspace
Dim bd As Database
Dim reg As Recordset
Private Sub Form_Load()
Set ws = DBEngine.Workspaces(0)
Set bd = ws.OpenDatabase("d:\Registro", False, False, "Foxpro 2.6;")
Set reg = bd.OpenRecordset("Registro", dbOpenDynaset)
Datos
CmdGrabar.Enabled = False
End Sub
Private Sub Datos()
If reg.EOF Then Exit Sub
If reg.BOF Then Exit Sub
TxtCodigo.Text = IIf(IsNull(reg!Copar), "", reg!Copar)
TxtApellidos.Text = IIf(IsNull(reg!Apell), "", reg!Apell)
TxtNombres.Text = IIf(IsNull(reg!Nombr), "", reg!Nombr)
TxtDni.Text = IIf(IsNull(reg!Lepar), "", Str$(reg!Lepar))
TxtLugar.Text = IIf(IsNull(reg!Lupar), "", reg!Lupar)
TxtFechaN.Text = IIf(IsNull(reg!Fnpar), "", reg!Fnpar)
TxtTele.Text = IIf(IsNull(reg!Tepar), "", Str$(reg!Tepar))
TxtDomicilio.Text = IIf(IsNull(reg!Dopar), "", reg!Dopar)
TxtReferencia.Text = IIf(IsNull(reg!Repar), "", reg!Repar)
TxtTelefono.Text = IIf(IsNull(reg!Trpar), "", Str$(reg!Trpar))
Txtcurso.Text = IIf(IsNull(reg!Nomcu), "", reg!Nomcu)
Txtcodig.Text = IIf(IsNull(reg!Codig), "", Str$(reg!Codig))
TxtHoras.Text = IIf(IsNull(reg!Horas), "", Str$(reg!Horas))
End Sub
Private Sub CmdGrabar_Click()
reg!Copar = RTrim$(TxtCodigo.Text)
reg!Apell = RTrim$(TxtApellidos.Text)
reg!Nombr = RTrim$(TxtNombres.Text)
reg!Lepar = RTrim$(TxtDni.Text)
reg!Lupar = RTrim$(TxtLugar.Text)
reg!Fnpar = RTrim$(TxtFechaN.Text)
reg!Tepar = RTrim$(TxtTele.Text)
reg!Dopar = RTrim$(TxtDomicilio.Text)
reg!Repar = RTrim$(TxtReferencia.Text)
reg!Trpar = RTrim$(TxtTelefono.Text)
reg!Nomcu = RTrim$(Txtcurso.Text)
reg!Codig = RTrim$(Txtcodig.Text)
reg!Horas = RTrim$(TxtHoras.Text)
If MsgBox("Desea Grabar el registro?", 4 + 32 + 256, "grabar") = 6 Then
reg.Update
End If
CmdGrabar.Enabled = False
End Sub
Valora esta pregunta


0