Access 2003 Tab Control On Change Event errors Save Record

  • Thread starter Gordon McCulloch Clarke
  • Start date
G

Gordon McCulloch Clarke

I am a knowledgeable MS Access developer, who is migrations MS Access 97
applications to MS Access 2003 and I have encountered the following problem.

I have a form maintaining a single record (Add/Edit/Delete), where the
majority of the fields are spread over 6 tab pages of a tab control, which
work fine.
However the seventh tab page supports a subform which uses Master/Child
links to allows the the maintainance of related records in a related table.
In MS Access 97, the Tab Control On Change event contained code to force a
write/update of the single record, using DoCmd.RunCommand acCmdSaveRecord,
and included code to trap any failure to write/update (either by Cancel in
Form_BeforeUpdate event or MS Access table validation failure). If the event
of any such failure the subform is made not visible and control remains on
the single record form. This worked well.

In MS Access 2003, the save record command now results in the error
"The command or action 'SaveRecord' isn't available now.

The save record command code in a Command Button work successfully.

Any ideas as to why MS Access 2003 Tab Control no longer allows the save
record command and any suggestions other than replacing all Page Tabs with
Command Buttons?
 
6

'69 Camaro

Hi, Gordon.
Any ideas as to why MS Access 2003 Tab Control no longer allows the save
record command

If it's any consolation, this will work if the main form isn't bound and MS
Office SP-1 is installed (and possibly without any SP's installed). In this
configuration, a bound subform will save the record as soon as the tab's page
is changed, so you may not even need this "save record" code in Access 2003.
(Which might be why you're getting that error message. "Save record" isn't
available when the record isn't dirty.)

Subforms with master/child links in Access 2003 are rather buggy. Subforms
on tab controls just add to the complexity that Access has to deal with.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
G

Gordon McCulloch Clarke

69 Camaro,

Thank you for you reply.
To resolve my problem, I have set the Tab control style to None, so there
are no tabs displayed, and then created labels for each of the tabs, which
are chiselled when selected and sunken when not selected. The on click event
of each label just setfocus to the corresponding page of the tab control,
apart from the one label which preceeds that with the saverecord. I then use
the Tab Control On-Change to adjust the label special effects.

The reason for this is that I did not want the subform displayed, if the
saverecord was not completed successfully. Which was possible by incorrect
entry of fields or user selection during the Before_Update event.

It would have been useful to have a Tab control event, which is a
Before_OnChange event, which can be cancelled, so that the change of tab is
not actioned.


Yours Gordon
 

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