Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
How to obtain field type
Versions des environnements
Hello
I need to know how i can obtain the field type when i run a recordset and i want to format its data fields. I have this code in VBA , i build them like this :
Private Sub nulos()
Dim rst1 As DAO.Recordset, i As Integer
Set rst1 = CurrentDb.OpenRecordset("select * from alojamentos")
Do While Not rst1.EOF
For i = 0 To rst1.Fields.Count - 1
'campos do tipo TEXT
If IsNull(rst1(i)) And (rst1(i).Type <> 8 And rst1(i).Type <> 7) Then
rst1.Edit
rst1(i) = " "
rst1.Update
'campos do tipo DATE
ElseIf IsNull(rst1(i)) And (rst1(i).Type = 8) Then
rst1.Edit
rst1(i) = 1
rst1.Update
'campos do tipo NUMERIC
ElseIf IsNull(rst1(i)) And (rst1(i).Type = 7) Then
rst1.Edit
rst1(i) = 0
rst1.Update
ElseIf Not IsNull(rst1(i)) And (rst1(i).Type = 10) Then
If Len(rst1(i)) = 0 Then
rst1.Edit
rst1(i) = " "
rst1.Update
End If
End If
Next i
rst1.MoveNext
Loop
MsgBox ("Já acabei...!")
End Sub
Like you see , for example if (rst1(i).Type = 7) is NUMERIC FIELD
I need to now for the field types in VFP.
Many Thanks
Luis Santos
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement