Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to obtain field type
Message
 
To
10/05/2005 17:31:11
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01012618
Message ID:
01012621
Views:
25
>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


Hi Luis...

Check out the TYPE() and VARTYPE() functions.

--Brad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform