How to overrule or change the insert a new record behaviour

  • Thread starter Thread starter Shiva
  • Start date Start date
S

Shiva

Hi,

I want to assign default values to some fields once the user adds a new
record to the table. Right now I'm doing this by executing some VBA-code in
the (form) before insert event. This works, but the user still has to modify
at least one field in order to fire the before insert event.
Actually, I want this action to be performed immediately after pressing the
"insert a new record"-button.
So isn't possible to overrule the actions carried out after pressing the
'insert a new record' button and replace its default action by an action
defined by myself (in VBA)?

Thanks in advance!
 
Shiva said:
Hi,

I want to assign default values to some fields once the user adds a
new record to the table. Right now I'm doing this by executing some
VBA-code in the (form) before insert event. This works, but the user
still has to modify at least one field in order to fire the before
insert event. Actually, I want this action to be performed immediately after
pressing the "insert a new record"-button.
So isn't possible to overrule the actions carried out after pressing
the 'insert a new record' button and replace its default action by an
action defined by myself (in VBA)?

Thanks in advance!

Why don't you just set the relevent DefaultValue properties?
 
Rick said:
Why don't you just set the relevent DefaultValue properties?

That doesn't work, because the default value is not always the same (I
presume you mean the default value of the table definition).
Actually, "default value" is not a correct description; the value is a kind
of autonumber field, though it is a little different.
 
If you can write a function which will return the value you want to have
inserted into the next new record, you can set that as the defaultvalue of
the control on the form (not the field in the table).

HTH
 
Shiva said:
That doesn't work, because the default value is not always the same (I
presume you mean the default value of the table definition).
Actually, "default value" is not a correct description; the value is
a kind of autonumber field, though it is a little different.

No, I mean the DefaultValue property of the control on the form. This can
be set on-the-fly as easily as the Value property using whatever logic you
are using now.
 
Back
Top