Rabu, 29 Agustus 2012

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

 

Phucon-

If your form is bound, there's no reason to use code to set the value. If you
want to display Yes/No in a separate text box, simply add a text box, set it's
Control Source to your number field, and set the Format property to Yes/No.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of saigonf7q5
Sent: Wednesday, August 29, 2012 5:10 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Change 0 or -1 value to Yes or No format

Good morning

Thanks for your help. It still does not do the job that I intend. Using the
Yes/No field would work, I was just trying to learn different technique which I
read from Allan Brown website "Why I stopped using Yes/No fields". However it's
interesting to find out why the value all become 0 (showing in the immediate
window) even they were entered into the field as -1.

Phucon

--- In MS_Access_Professionals@yahoogroups.com, "borninfulton" <rfalanga@...>
wrote:
>
> Hi Phucon,
>
> I had some difficulty reading your code, but that's likely due Yahoogroups
left justifying everything. I've made a few changes, and I hope that
Yahoogroups doesn't message up my response. Here's my Form_Open() method for
you:
>
> 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 <> 0 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
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "saigonf7q5" <saigonf7q5@>
wrote:
> >
> > 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
> >
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar