> Pressing Dn-Arr takes me to the next record because of the foll sub :
Ah. Okay.
[color=blue]
> Dim msg, msg1, msg2, msg3 As String[/color]
While we're at it: understand that in VBA, other than in VB, this
declares msg, msg1 and msg2 as *variant* (the default datatype). For
that reason I always Dim one variable per line.
[color=blue]
> If Me.NewRecord = True And Me.Sub_Tran_No >= 254 Then[/color]
NewRecord = True is redundant, although perfectly legitimate, easily
understandable and correct. I usually do "NewRecord And sub_tran_no>=254"
Can you be sure this test is water tight? I mean, if numbering starts at
-200, you have way over 255 records at number 254.
[color=blue]
> MsgBox msg1 & msg2, vbOKOnly + vbCritical, "Error !"[/color]
I don't think that is an error. It is a violation of a constraint you
created. "Correction required" seems to me to be a better voicing.
[color=blue]
> A couple of questions:
> -------------------------------
> 1) In the >254 case I used: SendKeys "^{PGUP}", True
> whereas you've used: docmd.gotorecord,,acprevious
>
> Which is better & why ??[/color]
docmd.gotorecord documents itself better; and the use of Sendkeys is a
frowned upon, sometimes SendKeys behaves a litte buggy (especially in
changing the NumLock state). But in general, if a statement/command is
available for the action you want, it's best to use it.
[color=blue]
> 2) Let's say I've already entered 254 rows of data. I position myself
> on the 250th row & start pressing Dn-Arr. The cursor behaves & goes
> down correctly. However, when I reach the last row, the cursor starts
> moving RIGHT into the next right field until it reaches the right-most
> field & pops up my err-msg. This seems to be the only glitch now. Rest
> all seems ok. If I click on a new record using the mouse or even press
> PgDn, the keyboard navigation behaves as expected.[/color]
Does it go away if from the KeyDown event (keydown? You should use KeyUp
to provide the user with a way out. But that is quite a different issue)
you don't do SendKeys ctrl-pgdn, but docmd.gotorecord,,acnext?
[color=blue]
> P.S. Cd u pls air-check my code to see if I've coded it correctly. I'm
> v.v. outa touch with programming.[/color]
You're not sending SMS to me! :-) what is v.v. here?
I already did that, before I read the question. Your style seems to
evoke it <evil grin> don't take offense :-) You have my comments.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
For human replies, replace the queue with a tea