Re: AddNew button on the Record selector
- From: Jac Tremblay <jac.tremblay@xxxxxxxxxxxxx>
- Date: Mon, 12 Dec 2005 06:36:07 -0800
Hi again Marsh,
I tried to try your solution, but cannot even figure out where to put the
code you're suggesting:
' ****************
If Me.NewRecord Then
' your code
End If
' ****************
The problem is that I have a parent form with a child form in it. For the
parent, it is impossible to insert a new record except through the special
home built insert procedure I wrote. That part works fine.
The problem happens when the user wants to insert a child record. For that
part, which uses the personalized procedure, everything works fine except for
a couple of details. The first one is that if the user clicks on the AddNew
button on the navigation bar on the child form, my procedure does not execute
and trouble starts.
The second (and last) problem is that when the user uses my personalized
button on the main form, I cannot get the display to show the last child
record (see the next post on this newsgroup), actually the new one that has
just been inserted even though I can create a new child record, calculate
some value based on the value the last child record has, and activate the
next field on the new record.
You suggest that I put my code in the "Form's Current event procedure" and
use the "Me." construct. That is not possible because the Me refers to the
parent and I am inserting into the child table. And also, I cannot find any
Current event procedure on the main form. I maybe wrong but I can't see how
to solve these problems.
Hope this will clarify the problem I have and eventually help in finding a
proper solution.
Thank you again for your concern.
--
Jac Tremblay
"Marshall Barton" wrote:
> Jac Tremblay wrote:
> >On my form, I had to create a personalized AddNew button because I need some
> >special calculations to be done when that event happens.
> >I need the record selector to be displayed for the user to navigate between
> >records (First, Previous, Next and Last).
> >But the record selector has an AddNew button also that does not do the same
> >thing as my personalized one. And that causes me a problem.
> >I would like to keep the record selector but disable the AddNew button or
> >get the button to run the procedure I wrote for the AddNew record.
>
>
> It sounds like you are talking about the Navigation buttons
> at the bottom of the form, not the Record Selector button at
> the left of each record.
>
> The New Record navigation button just takes you to a new
> record, it doesn't create a new record. That happens when
> the record is saved by navigating to a different record or
> several other actions.
>
> You can run your own procedure to set values in a new record
> by putting your code in the Form's Current event procedure:
>
> If Me.NewRecord Then
> ' your code
> End If
>
> without creating your own button or trying to fudge the
> navigation buttons.
>
> Note that if a user accidently navigates to a new record and
> your code sets the value of some bound controls, the user
> needs to hit the Esc key twice (to back out of the changes
> you made) before navigating to a different record.
>
> --
> Marsh
> MVP [MS Access]
>
.
- References:
- Re: AddNew button on the Record selector
- From: Marshall Barton
- Re: AddNew button on the Record selector
- Prev by Date: Transfer file from ftp and http programatically
- Next by Date: Re: AddNew button on the Record selector
- Previous by thread: Re: AddNew button on the Record selector
- Next by thread: Re: AddNew button on the Record selector
- Index(es):