Selasa, 28 Agustus 2012

[MS_AccessPros] Change 0 or -1 value to Yes or No format

 

One of the field of my table was set as NUMBER data type. The value of the field is either 0 or -1 to simulate a Yes/No field.

When this field was displayed in a form, it shows 0 or -1. I added a textbox next to it and try to display "Yes" or "No" instead of showing 0 and 1 by creating a procedure as shown below. However the value's never become True, it always displays 0 or No. What's wrong with that?

Private Sub Form_Open(Cancel As Integer)
Set rs = CurrentDb.OpenRecordset("StaffInfo", dbOpenSnapshot)
With rs
If Not .EOF Then
.Movefirst
Do
Debug.Print Me.IsSupervisor
.MoveNext
If Me.IsSupervisor.Value = -1 Then
Me!txtIsSupervisor.Value = "Yes"
Else
If Me.IsSupervisor = 0 Then
Me!txtIsSupervisor.Value = "No"
End If
End If
Loop Until .EOF
End If
End With
End Sub

Phucon

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar