[AccessD] Creating default false in yes/no field

Steve Schapel steve at datamanagementsolutions.biz
Sat Aug 2 15:12:38 CDT 2014


Bill

You could have saved yourself a bit of trouble here by simply binding the 
option group to the Yes/No field, and setting the Option Value of the option 
buttons to -1 and 0.

No hidden control, no code.

Regards
Steve


-----Original Message----- 
From: Bill Benson
Sent: Saturday, August 2, 2014 1:31 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Creating default false in yes/no field

I don't follow this thread completely, but in my recent project I have a
yes/no field in the database called Inactive, whose default is 0. How I
maintain that on the form is that I drag that field onto the form, and make
it invisible. I then have an Option Group (Frame) control with two Option
Buttons:
Control Value
optActive 1
optInactive 2

On Current, I populate the controls as:

Private Sub Form_Current()
If InActive = False Then
    frStatus = 1
Else
    frStatus = 2
End If
End Sub

And when the controls are updated I populate the field as:

Private Sub frStatus_AfterUpdate()
InActive = IIf(frStatus.Value = 1, False, True)
End Sub

If this is unrelated to what you are dealing with, I apologize.

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com 



More information about the AccessD mailing list