Adding a new record via Navigation Buttons - PK question

scottydel

Registered User.
Local time
Today, 04:19
Joined
Apr 18, 2007
Messages
35
Hello,

I have a continuous form bound to a table. The form's Navigation Buttons property is set to Yes, so I have the buttons at the bottom of the form giving me the ability to navigate between records, and especially the ability to add a new record (the button with the Arrow and Asterisk). The Primary Key field of my table is bound to a textbox control on the form, and the control's Locked property is set to Yes, so the PK cannot be edited for any existing records.

My dilemma is when I add a new record, my app does not allow me to edit this PK textbox control, and I am "stuck" in a endless state where the app insists I add something to the PK's textbox control, yet because this control is Locked, I cannot enter any text in it.

So my question is, is there an event I can use that will fire whever the default Add New Record button (button with an Arrow and an Asterisk) is clicked, and another event after a record is added, so I can Lock/Unlock this control as appropriately? Since these Navigation Buttons seem to have their code embedded (no VBA is added that I found), I can't see what they're actually doing.

Any help would be appreciated!

Thanks,

Scott
 
I think I have answered my own question by searching these forums and playing around a bit...

BeforeInsert and AfterInsert events seem to be what I'm after. I've done some coding and have solved my inital problem.

Now, I'd ideally like to elliminate the default Navigation Buttons and only have an Add New Record button (I have a pre-filled combo box for searching through all the records)...can anyone point me in the direction of some sample code for adding a new record button?

Thanks,

Scott
 
To lose the navigation buttons set the Form NavigationButton property to No. Then you can use the button wizard to add a button to add a new record.
 

Users who are viewing this thread

Back
Top Bottom