options

law

Registered User.
Local time
Today, 17:06
Joined
Feb 14, 2004
Messages
26
Can anyone give me some help with option buttons. I have a form with options on and the options are open or close. So for example if the user selects the option OPEN and the clicks the update command button which I have also got, then I need the record to be added/or remain in the table to a table. If the user selects the CLOSE option then I need the record to be deleted from the database.

Or does anyone know of any examples that I can look at?

Any help with this would be appreciated

Thanks
 
If the option group is either storing "OPEN" or "CLOSE" then the code in your Update command button should be something like this:
Code:
If Me.OptionGroup="OPEN" Then
    'code to keep record, if needed
Else
    'code to delete record
End If
That's also assuming you have a default value for the option group. You should probably set it to "OPEN".

I'm not sure you'll need code to keep the record, especially if your form controls are bound. To delete the current record on the form, you can use DoCmd.RunCommand acCmdDeleteRecord. Or if you form is not bound, you can use some DAO/ADO code.
 

Users who are viewing this thread

Back
Top Bottom