Cannot leave and save current record when using SetFocus

P

Pete

Re Access 2003 SP3

I have a continuous form which tests the OldValue against the current value
property for each control (Comboboxes, Textboxes & a Check box) in the
BeforeUpdate event. If they are different, a function (LogChangedData()) is
called from this event which logs the changes. This function compiles a text
string with the old & new values for those controls the user has changed –
for audit purposes.

The problem is – I need to SetFocus on a textbox to compare the old and the
new values, but, by doing this as part of the BeforeUpdate event, I cannot
move off the record if all checks are satisfied; and the AfterUpdate event
doesn’t fire. I have tried moving the focus to a control on the Form header,
but this doesn’t cure the problem. It’s definitely the calling of the
SetFocus method which is causing the problem.

Any suggestions would be greatly appreciated.

Many thanks.
 
J

Jeff Boyce

Pete

One possibility might be to add a 'dummy' control on the form to which you
can set the focus.

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
P

Pete

Many thanks for the reply Jeff.

I have changed an If-ElseIf statement to be individual If statements and
this appears to have cured the problem; although im not sure why?!

Many thanks again!
 

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