enable command button if Female

Muneer

New member
Local time
Today, 00:36
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
 
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!
 
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

Back
Top Bottom