New Record Loses Focus during Data Entry

B

Boris Nikolaevich

Sorry for the major crosspost--but in my defense I *did* try to pick
relevant groups!

Recently I have started having a problem in an Access 2000 ADP with SQL
server backend. I've done a lot of work trying to figure this out, and here
are my notes about what consistently happens. Can anyone help? I'm
baffled!!

-- This project has been in production for two years without a problem. The
strange behavior started two or three weeks ago.
-- When my data entry form is in continuous forms view or datasheet view and
I enter a new record, the current (new) record loses when as I begin typing
into a field.
-- The focus does not change the first time I type something into a field in
the row, but if I type into one field and move to the next, the focus will
always jump.
-- It does not matter what field I type into. The first field will work,
and the focus will jump when I press a key in the second field.
-- The focus changes to an existing record on the screen, but I have not
been able to see a pattern as far as *which* existing record it jumps to
(usually the previous record, but sometimes 20 records up, sometimes 8
records... etc.)
-- The "new" record is saved and I am able to return to it to finish
entering data.
-- The focus does not jump when I edit existing records. Only when I try to
enter a new record.
-- The focus does not jump when I select a value from a dropdown box or hit
CTRL+' to copy the previous record's value for a given field. Only when I
begin typing into any field.
-- There is only one source table. The source table has a primary key,
auto-generated by the server.
-- There are 5 comboboxes, 4 textboxes, and one checkbox. All exhibit the
same behavior (i.e on a new record, I type into any control, and the next
field I type into will cause the focus to jump.)
-- I do not have any KeyUp, KeyDown, or KeyPress events defined in the
form's code.
-- I do not have any SetFocus methods, commands, or statements in the form's
code.
-- The KeyPreview property of the form is False.
-- The value of the key I press in the new record's field is entered in
whichever record receives focus. For example, if I type "9/22/03" in the
Date field, and start to type "Telephone" in the description field, the
focus will jump as I hit the "T" key and "T" will be inserted into the field
which received focus. (The rest of the word gets inserted, too, if I'm
typing fast and don't notice quickly!)
-- I have some code in the Click event for the dropdown boxes that changes
the recordsource of subsequent boxes based on the selected value. However,
this problem occurs whether I select a value from the comboboxes or not.
This code has not changed since the form was designed.
-- I have some code in the BeforeInsert event for the form that checks for
comboboxes with no selection and sets the corresponding fields to NULL
(instead of empty string). However, this code does not fire until the
record is [about to be] inserted, so I can't see that it's the problem.
This code has not changed since the form was designed.
-- I have tried restoring from an earlier copy of the project (even though
the code has not changed).
-- I have tried re-creating the connection to the SQL server.
-- I have tried decompiling and recompiling the project.
-- I have tried valium.
-- I am using Access 2000 version 9.0.4402 SR-1 on Windows XP version
5.1.2600.

Thanks for taking the time to read through this, and double thanks if you
have any ideas!
--Boris
 
B

Boris Nikolaevich

One more:

-- The problem does not seem to occur with other forms in the project, even
when they are in Continuous Forms or Datasheet views.
 
K

Ken Snell

One thought could be a corrupted form. Try recreating the form?

--
Ken Snell
<MS ACCESS MVP>

Boris Nikolaevich said:
Sorry for the major crosspost--but in my defense I *did* try to pick
relevant groups!

Recently I have started having a problem in an Access 2000 ADP with SQL
server backend. I've done a lot of work trying to figure this out, and here
are my notes about what consistently happens. Can anyone help? I'm
baffled!!

-- This project has been in production for two years without a problem. The
strange behavior started two or three weeks ago.
-- When my data entry form is in continuous forms view or datasheet view and
I enter a new record, the current (new) record loses when as I begin typing
into a field.
-- The focus does not change the first time I type something into a field in
the row, but if I type into one field and move to the next, the focus will
always jump.
-- It does not matter what field I type into. The first field will work,
and the focus will jump when I press a key in the second field.
-- The focus changes to an existing record on the screen, but I have not
been able to see a pattern as far as *which* existing record it jumps to
(usually the previous record, but sometimes 20 records up, sometimes 8
records... etc.)
-- The "new" record is saved and I am able to return to it to finish
entering data.
-- The focus does not jump when I edit existing records. Only when I try to
enter a new record.
-- The focus does not jump when I select a value from a dropdown box or hit
CTRL+' to copy the previous record's value for a given field. Only when I
begin typing into any field.
-- There is only one source table. The source table has a primary key,
auto-generated by the server.
-- There are 5 comboboxes, 4 textboxes, and one checkbox. All exhibit the
same behavior (i.e on a new record, I type into any control, and the next
field I type into will cause the focus to jump.)
-- I do not have any KeyUp, KeyDown, or KeyPress events defined in the
form's code.
-- I do not have any SetFocus methods, commands, or statements in the form's
code.
-- The KeyPreview property of the form is False.
-- The value of the key I press in the new record's field is entered in
whichever record receives focus. For example, if I type "9/22/03" in the
Date field, and start to type "Telephone" in the description field, the
focus will jump as I hit the "T" key and "T" will be inserted into the field
which received focus. (The rest of the word gets inserted, too, if I'm
typing fast and don't notice quickly!)
-- I have some code in the Click event for the dropdown boxes that changes
the recordsource of subsequent boxes based on the selected value. However,
this problem occurs whether I select a value from the comboboxes or not.
This code has not changed since the form was designed.
-- I have some code in the BeforeInsert event for the form that checks for
comboboxes with no selection and sets the corresponding fields to NULL
(instead of empty string). However, this code does not fire until the
record is [about to be] inserted, so I can't see that it's the problem.
This code has not changed since the form was designed.
-- I have tried restoring from an earlier copy of the project (even though
the code has not changed).
-- I have tried re-creating the connection to the SQL server.
-- I have tried decompiling and recompiling the project.
-- I have tried valium.
-- I am using Access 2000 version 9.0.4402 SR-1 on Windows XP version
5.1.2600.

Thanks for taking the time to read through this, and double thanks if you
have any ideas!
--Boris
 
V

Vadim Rapp

BN> I have tried valium.

Remove ordering of the form and/or its recordsource.

Vadim
 
B

Boris Nikolaevich

Not fun, but I spent the past five hours doing that. The form works as it
should now, even though it is [appears to be] identical to the first.

Ken Snell said:
One thought could be a corrupted form. Try recreating the form?

--
Ken Snell
<MS ACCESS MVP>

Boris Nikolaevich said:
Sorry for the major crosspost--but in my defense I *did* try to pick
relevant groups!

Recently I have started having a problem in an Access 2000 ADP with SQL
server backend. I've done a lot of work trying to figure this out, and here
are my notes about what consistently happens. Can anyone help? I'm
baffled!!

-- This project has been in production for two years without a problem. The
strange behavior started two or three weeks ago.
-- When my data entry form is in continuous forms view or datasheet view and
I enter a new record, the current (new) record loses when as I begin typing
into a field.
-- The focus does not change the first time I type something into a
field
in
the row, but if I type into one field and move to the next, the focus will
always jump.
-- It does not matter what field I type into. The first field will work,
and the focus will jump when I press a key in the second field.
-- The focus changes to an existing record on the screen, but I have not
been able to see a pattern as far as *which* existing record it jumps to
(usually the previous record, but sometimes 20 records up, sometimes 8
records... etc.)
-- The "new" record is saved and I am able to return to it to finish
entering data.
-- The focus does not jump when I edit existing records. Only when I
try
to
enter a new record.
-- The focus does not jump when I select a value from a dropdown box or hit
CTRL+' to copy the previous record's value for a given field. Only when I
begin typing into any field.
-- There is only one source table. The source table has a primary key,
auto-generated by the server.
-- There are 5 comboboxes, 4 textboxes, and one checkbox. All exhibit the
same behavior (i.e on a new record, I type into any control, and the next
field I type into will cause the focus to jump.)
-- I do not have any KeyUp, KeyDown, or KeyPress events defined in the
form's code.
-- I do not have any SetFocus methods, commands, or statements in the form's
code.
-- The KeyPreview property of the form is False.
-- The value of the key I press in the new record's field is entered in
whichever record receives focus. For example, if I type "9/22/03" in the
Date field, and start to type "Telephone" in the description field, the
focus will jump as I hit the "T" key and "T" will be inserted into the field
which received focus. (The rest of the word gets inserted, too, if I'm
typing fast and don't notice quickly!)
-- I have some code in the Click event for the dropdown boxes that changes
the recordsource of subsequent boxes based on the selected value. However,
this problem occurs whether I select a value from the comboboxes or not.
This code has not changed since the form was designed.
-- I have some code in the BeforeInsert event for the form that checks for
comboboxes with no selection and sets the corresponding fields to NULL
(instead of empty string). However, this code does not fire until the
record is [about to be] inserted, so I can't see that it's the problem.
This code has not changed since the form was designed.
-- I have tried restoring from an earlier copy of the project (even though
the code has not changed).
-- I have tried re-creating the connection to the SQL server.
-- I have tried decompiling and recompiling the project.
-- I have tried valium.
-- I am using Access 2000 version 9.0.4402 SR-1 on Windows XP version
5.1.2600.

Thanks for taking the time to read through this, and double thanks if you
have any ideas!
--Boris
 
B

Boris Nikolaevich

I would have loved to have tried this suggestion, mostly out of curiosity,
but Ken's reply was the one I read first. The record source was simply
"SELECT * FROM tblOrders ORDER BY OrderDate". No "order by" or "filter"
properties were set on the form.

Can you tell me what about the ordering of the recordset would have caused
this behavior? It would be a great tip for future reference.

Thanks,
Boris
 
V

Vadim Rapp

BN> Not fun, but I spent the past five hours doing
BN> that.

might be more fun using SaveAsText...


BN> Can
BN> you tell me what about the ordering of the
BN> recordset would have
BN> caused this behavior?

As I recall, it was fixed in Access 2002. Before, Access was trying to
immediately include the new row in the ordering, and was unsuccessful.


Vadim
 
B

Boris Nikolaevich

SaveAsText / LoadFromText was one of the first things I tried when I
decided it could be a corruption issue. Didn't help. Neither did the
/decompile switch, or deleting the form, closing Access, reopening,
and importing the form from an old backup copy of the project. But it
was a great idea!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top