Dar valor a campo vacio en ACCESS2003
Publicado por marcux1 (4 intervenciones) el 10/05/2012 11:23:23
Hola a todos/as,
mi pregunta es la siguiente :
tengo una tabla (tempAtribut) que tiene los campos
F9 (texto)
ATRIBUT (texto)
el campo ATRIBUT en algunos registros esta lleno y en otros esta vacío.
me estoy comiendo el coco para intentar que cuando el campo ATRIBUT esté vacío, se rellene con el valor de F9...
por el momento he creado un formulario aparte con un boton de comando al que le pongo este código (aprovechado de otra bbdd que hacia otra funcion diferente), pero evidentemente algo esta mal porqué me da error...
Private Sub Comando0_Click()
Dim vNum As String, vInicio As String
Dim f9num As String
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tempAtribut")
rst.MoveFirst
Do Until rst.EOF
vNum = rst.Fields("ATRIBUT").Value
f9num = rst.Fields("F9").Value
vInicio = vNum
If vInicio = " " Then
vNum = f9num
With rst
.Edit
.Fields("ATRIBUT").Value = vNum
.Update
End With
End If
rst.MoveNext
Loop
MsgBox "Reemplazo realizado correctamente", vbInformation, "OK"
End Sub
al ejecutar el boton me da el siguiente error "Error de compilación : no se ha definido el tipo definido por el usuario"
alguien me puede ayudar??
muchas gracias!!!
Saludos Marc
mi pregunta es la siguiente :
tengo una tabla (tempAtribut) que tiene los campos
F9 (texto)
ATRIBUT (texto)
el campo ATRIBUT en algunos registros esta lleno y en otros esta vacío.
me estoy comiendo el coco para intentar que cuando el campo ATRIBUT esté vacío, se rellene con el valor de F9...
por el momento he creado un formulario aparte con un boton de comando al que le pongo este código (aprovechado de otra bbdd que hacia otra funcion diferente), pero evidentemente algo esta mal porqué me da error...
Private Sub Comando0_Click()
Dim vNum As String, vInicio As String
Dim f9num As String
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tempAtribut")
rst.MoveFirst
Do Until rst.EOF
vNum = rst.Fields("ATRIBUT").Value
f9num = rst.Fields("F9").Value
vInicio = vNum
If vInicio = " " Then
vNum = f9num
With rst
.Edit
.Fields("ATRIBUT").Value = vNum
.Update
End With
End If
rst.MoveNext
Loop
MsgBox "Reemplazo realizado correctamente", vbInformation, "OK"
End Sub
al ejecutar el boton me da el siguiente error "Error de compilación : no se ha definido el tipo definido por el usuario"
alguien me puede ayudar??
muchas gracias!!!
Saludos Marc
Valora esta pregunta
0