Access does not save some records...any ideas why?!

  • Thread starter Thread starter Contro
  • Start date Start date
C

Contro

Hi guys!

I've got a very strange problem. Basically, I have an access table of
data, which users can input values into via a form. Some parts of this

form have vb code to enable the user to input a shortcut for a word,
such as "e" for "English" and then the VB code will convert it into the

full word, saving the user time. This works on an "On Exit" principle,

so it only changes it once the user tabs out of the text area. There
are a few similar boxes in a row, all after each other in the tab
order, and some after and before which do not have VB code at all.

The problem is that sometimes access doesn't seem to save this data
(any of it, not just the text entered into a text box with some VB code

behind it). You enter it in, all fine, but then when you come back
later, it has disappeared.

It has since been discovered that if you keep tabbing to a text area
that doesn't have vb code, the entries are always saved and do not
disappear.

Has anyone ever come accross this before, and if so, how can you stop
it occuring? It just doesn't seem to make any sense!

Any help would be hugely appreciated. Thank you in advance!

Contro.
 
Try using the BeforeUpdate Event rather than the Exit Event.

This is cause of the order:

BeforeUpdate event triggered (If Cancel variable not set to "True", then
continue on)

Control is Updated (though I have found the updated values of the properties
on a listbox is not available to VBA when it's selection mode is set to
"Multiple" or "Extended", which then it's not available until the control
has lost it's focus).

AfterUpdate event is triggered

If focus is about to move to another control, Exit event is triggered (If
Cancel variable not set to "True", then continue on)

LostFocus event triggered

Enter event of the next control triggered (If there is no SetFocus method
within this event, move on)

GotFocus of the next control is triggered



Also, check into your form level of BeforeUpdate event as well as any other
requirements you may have set on the controls/fields such as Validation
Rules you may have set on either the control or field, or the field is a
required value and must match to a value of an underlying lookup table.
These are just a couple of examples to look for as in combination as to why
it's not updated. This is also why I'm recommending you to use the
BeforeUpdate event rather than the Exit event on the control to make the
adjustment that you are wanting.
 
Hi there! Thank you very much for getting back to me.

I've tried to do what you say, but, as you predicted, I get error
-2147352567, mentioning about validation rules and such like which is
preventing the database from saving the information. The only problem
is that I have not put any validation rules on the text (other than vb
code). I do not understand what it can be, as the text is not
required, zero length is allowed etc etc. Are there any stealth ones
that you are aware of that could be causing this?

Thank you once more for your help. This problem has been a huge pain
to say the least!

Contro.
 
Back
Top