PC Review


Reply
Thread Tools Rate Thread

BeforeUpdate not firing

 
 
Lars Brownies
Guest
Posts: n/a
 
      28th Apr 2009
To prevent corruption I'm working with an unbound field in my form. The
unbound field's afterupdate event puts the value in the underlying memofield
and saves it. The form's beforeInsert doesn't fire when I start on a blank
record and when the unboud field is the first field that is entered.

In the form's beforeInsert event I have code that enters some values in
different fields.

How can I fix this so when the user starts with the unbound field, that the
form's beforeInsert gets fired and the values get entered?

Thanks,

Lars


 
Reply With Quote
 
 
 
 
Graham Mandeno
Guest
Posts: n/a
 
      28th Apr 2009
Hi Lars

You could check to see if action is required and call BeforeInsert
"manually":

If Me.NewRecord and IsNull(Me.[some field that gets a value]) Then
Call Form_BeforeInsert(0)
End If

The next question is where to out this code?

If you can wait until txtUnboundMemo_AfterUpdate, then insert it there.

If you must have the fields populated before the user types into the field,
use txtUnboundMemo_GotFocus.

If you need to exactly mimic the BeforeInsert behaviour (execute on first
keypress) then use txtUnboundMemo_KeyPress.

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand


"Lars Brownies" <(E-Mail Removed)> wrote in message
news:gt7o67$12ng$(E-Mail Removed)...
> To prevent corruption I'm working with an unbound field in my form. The
> unbound field's afterupdate event puts the value in the underlying
> memofield and saves it. The form's beforeInsert doesn't fire when I start
> on a blank record and when the unboud field is the first field that is
> entered.
>
> In the form's beforeInsert event I have code that enters some values in
> different fields.
>
> How can I fix this so when the user starts with the unbound field, that
> the form's beforeInsert gets fired and the values get entered?
>
> Thanks,
>
> Lars
>



 
Reply With Quote
 
Lars Brownies
Guest
Posts: n/a
 
      28th Apr 2009
Thanks Graham,

>> IsNull(Me.[some field that gets a value])


I can use the autonumber field for that.

> If you need to exactly mimic the BeforeInsert behaviour (execute on first
> keypress) then use txtUnboundMemo_KeyPress.


Good idea!


"Graham Mandeno" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Hi Lars
>
> You could check to see if action is required and call BeforeInsert
> "manually":
>
> If Me.NewRecord and IsNull(Me.[some field that gets a value]) Then
> Call Form_BeforeInsert(0)
> End If
>
> The next question is where to out this code?
>
> If you can wait until txtUnboundMemo_AfterUpdate, then insert it there.
>
> If you must have the fields populated before the user types into the
> field, use txtUnboundMemo_GotFocus.
>
> If you need to exactly mimic the BeforeInsert behaviour (execute on first
> keypress) then use txtUnboundMemo_KeyPress.
>
> --
> Good Luck :-)
>
> Graham Mandeno [Access MVP]
> Auckland, New Zealand
>
>
> "Lars Brownies" <(E-Mail Removed)> wrote in message
> news:gt7o67$12ng$(E-Mail Removed)...
>> To prevent corruption I'm working with an unbound field in my form. The
>> unbound field's afterupdate event puts the value in the underlying
>> memofield and saves it. The form's beforeInsert doesn't fire when I start
>> on a blank record and when the unboud field is the first field that is
>> entered.
>>
>> In the form's beforeInsert event I have code that enters some values in
>> different fields.
>>
>> How can I fix this so when the user starts with the unbound field, that
>> the form's beforeInsert gets fired and the values get entered?
>>
>> Thanks,
>>
>> Lars
>>

>
>



 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      29th Apr 2009
On Tue, 28 Apr 2009 22:16:07 +0200, Lars Brownies wrote:

> To prevent corruption I'm working with an unbound field in my form. The
> unbound field's afterupdate event puts the value in the underlying
> memofield and saves it. The form's beforeInsert doesn't fire when I
> start on a blank record and when the unboud field is the first field
> that is entered.
>
> In the form's beforeInsert event I have code that enters some values in
> different fields.
>
> How can I fix this so when the user starts with the unbound field, that
> the form's beforeInsert gets fired and the values get entered?


BeforeInsert is not guaranteed to fire. That's the reason I never use it.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BeforeUpdate code not firing =?Utf-8?B?S3VydA==?= Microsoft Access Form Coding 1 3rd Aug 2005 06:03 PM
SubForm's BeforeUpdate Event Not Firing =?Utf-8?B?bWF4?= Microsoft Access Form Coding 4 15th Nov 2004 05:45 PM
Text Box's BeforeUpdate Event Not Firing MikeC Microsoft Access Form Coding 5 24th Oct 2004 03:59 AM
BeforeUpdate Jack Microsoft Access VBA Modules 1 27th Aug 2003 05:16 PM
Re: field's BeforeUpdate vs form's BeforeUpdate Allen Browne Microsoft Access Forms 1 31st Jul 2003 01:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:02 AM.