Re: How to trap the previous record mouse-click ?



On May 12, 1:25 am, "Larry Linson" <boun...@xxxxxxxxxxxxx> wrote:
It is always difficult to assist in remote debugging, it is impossible when
the question asked is not the question you desire to be answered -- no
mention at all of Subform Controls in the original.  In Access, you are
handicapping yourself if you expect that Forms in a Subform Control will
work as a similar main Form would work.  You've gotten some good advice,
and, I just don't have time and energy to go back and put your three
questions and clarifications together to see if I can puzzle out what you
have and what you really need to do. Newsgroups are a great place to get
help, but they aren't like talking face-to-face so you can get immediate
feedback. There are some good suggestions on effective use of newsgroups in
the comp.databases.ms-access FAQ athttp://www.mvps.org/access/netiquette.

 Larry Linson
 Microsoft Office Access MVP

<prakashwadhw...@xxxxxxxxx> wrote in message

news:14a074ea-8a3b-4581-9174-46d8d3a961bd@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On May 11, 6:24 pm, Tom van Stiphout <tom7744.no.s...@xxxxxxx> wrote:



On Mon, 11 May 2009 02:28:50 -0700 (PDT), prakashwadhw...@xxxxxxxxx
wrote:

You may be using the wrong event. Rather than Form_Current I would put
the New ID code in Form_BeforeInsert. That way the form is blank until
the user types the first character in some field (and thus indicates
to be committed to creating a new record).

The user can always move away from a blank record. No code needed.

There is no need to write code in Form_BeforeUpdate to test if
required fields are filled out; simply set those fields to required in
the table design. BeforeUpdate is for validation on top of that.

-Tom.
Microsoft Access MVP

On May 10, 7:55 pm, "Larry Linson" <boun...@xxxxxxxxxxxxx> wrote:
AFAIK, only by saving the key of the record, and testing in the Current
event to see if the current key is less (or more, if you happen to have
ordered the records in descending sequence), then saving the current
key to
test "next time".

But you can opt to not display the navigation bar, and put in your own
navigation controls -- some do so just because the nav bar is so small;
others so they can execute event code. The command button wizard will
even
assist you (in Access 2003 and earlier, by generating code, and I
suspect
the Access 2007 will generate <UGH> macros (record navigation seems a
safe
enough operation to have made the transition).

Larry Linson
Microsoft Office Access MVP

<prakashwadhw...@xxxxxxxxx> wrote in message

news:a7af87f8-6e71-4a5d-b63f-810050e8ca5b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I want to trap the previous record mouse-click on Access's Navigation
Bar.

i.e. if the user clicks the small left arrow to go to the previous
record, I'd like to trap that event & do something.

Is it possible ?

Best Rgds,
Prakash.

Ok. Let me be a bit more specific.

In the Current Event of my form I have the foll code:

Private Sub Form_Current()
If Me.NewRecord = True Then
LBL_LPO_NO.Caption = Nz(DMax("LPO_No", "LPO_Mst")) + 1
--> Me.LPO_NO = Nz(DMax("LPO_No", "LPO_Mst")) + 1
Me.Txt_LPO_Date.SetFocus
Else
LBL_LPO_NO.Caption = Me.LPO_NO
End If
End Sub

As you can see whenever the user navigates to a new record,
one field (the LPO Number) is filled by default.
i.e. Me.LPO_NO = Nz(DMax("LPO_No", "LPO_Mst")) + 1

Now when the user clicks the left arrow on Access's Navigation Button
my BeforeUpdate event kicks in which prevents the form from
traversing
backwards until some other fields are also filled in and validated.
If I press "Esc", it undoes the default filled value & only then can I
navigate backwards.

So ... what I'd like is: IF ALL fields in the form are BLANK and the
user clicks the left arrow on Access's Navigation Button,
I'd like the form to roll back to the previous record.

Any ideas ??

Best Rgds,
Prakash.

Thx Tom. Your solution is just what I required. However, this LPO
Number field is in the Master Form. There is also a subform within
this having another LPO Number field. Obviously both are related.

Now ... using my method in the current event ... whenever I try to
type into the subform, the LPO Number from the Master form is
automatically inserted into the subform without any code. However,
using the BeforeInsert event does not trigger this behaviour.

I also do not want to make & code my own navigation buttons.

Any other solution ?  I'm sure there's something small I'm
overlooking.

Best Rgds,
Prakash.



Larry, to begin with, please accept my UNCONDITIONAL apologies for not
having presented my case correctly in the required detail.

You along with a lot of others here on this NG are performing a yeoman
service by taking out a lot of your valuable time and helping unknowns
like me from all corners of the world for absolutely nothing in
return. I know some people read, benefit from your advice and don't
even bother to post back whether it worked, let alone thank you.

I honestly thought that all I needed to do was trap the previous
record mouse-click on Access's Navigation Bar. If it referred to the
subform I figured I could use Forms! etc. to refer to the right form
once I got the property or event. However one thing led to another and
eventually I had to open the entire book.

I can certainly understand how baffling & frustrating it is to grope
in the dark & help people like me ... and especially when the
information furnished is inadequate.

So please once again kindly accept my apologies but please do bear in
mind that I didn't hold back any information deliberately or out of
negligence. I genuinely felt I was missing some miniscule property or
event.

Your sound advice & insight has helped me umpteen times in the past &
I'm really grateful for that.

Thx & Best Rgds,
Prakash.
.



Relevant Pages

  • Re: How to trap the previous record mouse-click ?
    ... mention at all of Subform Controls in the original. ... Microsoft Office Access MVP ... user clicks the left arrow on Access's Navigation Button, ... However, this LPO ...
    (comp.databases.ms-access)
  • Re: How to trap the previous record mouse-click ?
    ... Microsoft Access MVP ... the Access 2007 will generate macros (record navigation seems a safe ... However, this LPO ... There is also a subform within ...
    (comp.databases.ms-access)
  • Re: How to trap the previous record mouse-click ?
    ... Microsoft Access MVP ... the Access 2007 will generate macros (record navigation seems a safe ... However, this LPO ... There is also a subform within ...
    (comp.databases.ms-access)
  • Re: How to trap the previous record mouse-click ?
    ... mention at all of Subform Controls in the original. ... Microsoft Office Access MVP ... navigation controls -- some do so just because the nav bar is so ... Larry, to begin with, please accept my UNCONDITIONAL apologies for not ...
    (comp.databases.ms-access)
  • Re: How to trap the previous record mouse-click ?
    ... mention at all of Subform Controls in the original. ... navigation controls -- some do so just because the nav bar is so small; ... However, this LPO ...
    (comp.databases.ms-access)