General information
Category:
Coding, syntax & commands
Title:
How to obtain field type
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only