enable command button if Female (1 Viewer)

Muneer

New member
Local time
Today, 10:27
Joined
Jul 17, 2000
Messages
7
Hello every one
I have a main form shoing medical information and a Button to add Pregnancy info,
How can I disable the command button If the Sex Field is "Male"
any solution
Thank youn all
 

gino

Registered User.
Local time
Today, 10:27
Joined
Mar 16, 2000
Messages
117
first have the command button not enabled in the properties. second put this code in the appropiate event where you need this validation to take action.

if me.sexfield ="female" then
me.commandbutton.enabled = true
else
'do nothing
end if

i'm thinking maybe in the OnOpen event!

modify this if you must.
have fun!
 

mikec

Registered User.
Local time
Today, 10:27
Joined
Dec 17, 1999
Messages
22
Muneer,

In the OnCurrent event of the form, put the folowing code:

If me.genderfieldname = "Female" Then
me.cmdbuttonname.enabled = True
Else me.cmdbuttonname.enabled = False
End If

This will turn the button on and off as you cycle through the records.

You'll also want to put the same code in the AfterUpdate event of the gender field so that when the record is first created, the button will be correct when that field is first populated.

Regards,

Mike
 

Users who are viewing this thread

Top Bottom