Enable form options only if it's a new record

BrotherBook

Registered User.
Local time
Today, 10:40
Joined
Jan 22, 2013
Messages
43
Hi-

I am working on an Access database where people will be entering & editing potential sales leads. Currently i have made two forms, one for entering a new lead and one for editing existing records. The difference between the two comes down to which record the form launches to and the New Sales lead form has two command buttons that the edit sales lead does not.

I was hoping to only have one form that would enable or disable the command buttons depending on if it was a new record or not.

On my main form i have a button for "Add New Sales Lead" and "Modify Sales" lead. Is it possible to set the Form_Load vba to enable or disable command buttons if it is a new record? Perhaps something with AcNewRec?

Thanks
-Mike
 
You could test the NewRecord property in the form's On Current event. Something along the lines of;
Code:
Me.YourCommandButton.Enabled = frm.NewRecord
Would enable the button only when there was a new record, or
Code:
Me.YourCommandButton.Enabled  = Not Me.NewRecord
Would enable the button only when it was an existing record.
 

Users who are viewing this thread

Back
Top Bottom