Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Question of preference

Discussion in 'Information Technology' started by Garret, Jul 28, 2006.

  1. Garret

    Garret
    Expand Collapse
    Guest

    For those of you who program many database systems, here is the
    question:

    When you have the same event that occurs on many forms, such as Save,
    Delete, Search, etc, do you include the same methods under each form's
    code, or do you write a global function that all of the command buttons
    for Save, Delete, etc call to when pressed? Is it more efficient this
    way or is it just more of a confusing mess?
     
  2. Loading...

    Similar Threads Forum Date
    Question About GGS Questions and Answers Aug 28, 2016
    Marriage And Discrimination Related Questions Blogs Mar 21, 2016
    Sikhi Questioning Faith Sikh Sikhi Sikhism Mar 3, 2016
    Entering into Sikhism: Questions on Reht Maryada. Blogs Oct 22, 2015
    A question about kes/hair? Blogs Oct 21, 2015

  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Why create all these buttons on each form?

    You can create a toolbar that has all the buttons you need, and assign it to
    the Toolbar of each form. Job done.

    Surely the toolbar, menu, and keyboard is enough without a command button as
    well:
    - Save: Toolbar button. Records Menu. Shift+Enter on keyboard.
    - Delete: Toolbar button. Edit menu. Del on keyboard (after selecting
    record.)
    - Find: Toolbar button. Edit menu. Ctrl+F on keyboard.
    - Undo: Toolbar button. Edit menu. Esc on keyboard.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Garret" <garretdoe@hotmail.com> wrote in message
    news:1151509459.510623.212430@d56g2000cwd.googlegroups.com...
    > For those of you who program many database systems, here is the
    > question:
    >
    > When you have the same event that occurs on many forms, such as Save,
    > Delete, Search, etc, do you include the same methods under each form's
    > code, or do you write a global function that all of the command buttons
    > for Save, Delete, etc call to when pressed? Is it more efficient this
    > way or is it just more of a confusing mess?
     
  4. Garret

    Garret
    Expand Collapse
    Guest

    Allen Browne wrote:
    > Why create all these buttons on each form?
    >
    > You can create a toolbar that has all the buttons you need, and assign it to
    > the Toolbar of each form. Job done.
    >
    > Surely the toolbar, menu, and keyboard is enough without a command button as
    > well:
    > - Save: Toolbar button. Records Menu. Shift+Enter on keyboard.
    > - Delete: Toolbar button. Edit menu. Del on keyboard (after selecting
    > record.)
    > - Find: Toolbar button. Edit menu. Ctrl+F on keyboard.
    > - Undo: Toolbar button. Edit menu. Esc on keyboard.
    >


    My command buttons for Save and Delete are customized to have popup
    boxes and affect some attributes on other forms.
     
  5. BruceM

    BruceM
    Expand Collapse
    Guest

    I have started using a code module for custom form navigation buttons and
    record counter, and things like that. However, sometimes you needs specific
    references to a table or form, so a public function may not be much use. I
    would say that if it is practical you may as well use a "global" function,
    but there are standard methods (such as toolbars) to accomplish at least
    some of what you need with relatively little effort.

    "Garret" <garretdoe@hotmail.com> wrote in message
    news:1151512599.898144.156580@d56g2000cwd.googlegroups.com...
    >
    > Allen Browne wrote:
    >> Why create all these buttons on each form?
    >>
    >> You can create a toolbar that has all the buttons you need, and assign it
    >> to
    >> the Toolbar of each form. Job done.
    >>
    >> Surely the toolbar, menu, and keyboard is enough without a command button
    >> as
    >> well:
    >> - Save: Toolbar button. Records Menu. Shift+Enter on keyboard.
    >> - Delete: Toolbar button. Edit menu. Del on keyboard (after selecting
    >> record.)
    >> - Find: Toolbar button. Edit menu. Ctrl+F on keyboard.
    >> - Undo: Toolbar button. Edit menu. Esc on keyboard.
    >>

    >
    > My command buttons for Save and Delete are customized to have popup
    > boxes and affect some attributes on other forms.
    >
     
  6. Paul Overway

    Paul Overway
    Expand Collapse
    Guest

    I use a common validation class, but the standard Access toolbar buttons and
    other features are usually all that is needed for navigation, editing,
    deleting, search, etc.. However, for delete, I sometimes have to code
    specifically for the record being deleted, i.e., there may be related
    records in other tables...so, writing common code for that purpose wouldn't
    save much time anyway.

    For the validation class, I insert a Function in each form module called
    IsValid that gets called in Form_BeforeUpdate. The IsValid function
    instantiates the validator...and each control gets passed to the validator
    with the associated label text so the user gets prompted if an entry is
    missing. I wrote a wizard to insert all the necessary code automatically.

    --
    Paul Overway
    Logico Solutions, LLC
    www.logico-solutions.com


    "Garret" <garretdoe@hotmail.com> wrote in message
    news:1151509459.510623.212430@d56g2000cwd.googlegroups.com...
    > For those of you who program many database systems, here is the
    > question:
    >
    > When you have the same event that occurs on many forms, such as Save,
    > Delete, Search, etc, do you include the same methods under each form's
    > code, or do you write a global function that all of the command buttons
    > for Save, Delete, etc call to when pressed? Is it more efficient this
    > way or is it just more of a confusing mess?
    >
     
  7. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    So what happens if the user saves the record some other way, e.g. by:
    - merely closing the form;
    - applying a filter;
    - changing the sort order;
    - closing Access;
    - pressing Shift + Enter;
    - through the Records menu;
    - tabbing to another record;
    - refreshing (Records menu);
    - pressing F9;
    - etc.

    You *really* need to use the AfterUpdate event of the form if you want to
    make some changes elsewhere.

    Of course, you might need to consider whether you are breaking the basic
    rules of normalization that require you do not:
    - store dependent data, or
    - store redundant data.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Garret" <garretdoe@hotmail.com> wrote in message
    news:1151512599.898144.156580@d56g2000cwd.googlegroups.com...
    >
    > Allen Browne wrote:
    >> Why create all these buttons on each form?
    >>
    >> You can create a toolbar that has all the buttons you need, and assign it
    >> to
    >> the Toolbar of each form. Job done.
    >>
    >> Surely the toolbar, menu, and keyboard is enough without a command button
    >> as
    >> well:
    >> - Save: Toolbar button. Records Menu. Shift+Enter on keyboard.
    >> - Delete: Toolbar button. Edit menu. Del on keyboard (after selecting
    >> record.)
    >> - Find: Toolbar button. Edit menu. Ctrl+F on keyboard.
    >> - Undo: Toolbar button. Edit menu. Esc on keyboard.
    >>

    >
    > My command buttons for Save and Delete are customized to have popup
    > boxes and affect some attributes on other forms.
     
  8. Garret

    Garret
    Expand Collapse
    Guest

    Well right now I have my "Save Confirm" messages in the BeforeUpdate
    event. In actually, the BeforeUpdate event of all forms where data can
    be added or updated calls to a function I have in a module since the
    same confirmation message box appears on each of the 10-15 forms I
    have. This was more of what my question was about.
    I think Paul Overway's response did well to answer my quesiton though.

    Allen Browne wrote:
    > So what happens if the user saves the record some other way, e.g. by:
    > - merely closing the form;
    > - applying a filter;
    > - changing the sort order;
    > - closing Access;
    > - pressing Shift + Enter;
    > - through the Records menu;
    > - tabbing to another record;
    > - refreshing (Records menu);
    > - pressing F9;
    > - etc.
    >
    > You *really* need to use the AfterUpdate event of the form if you want to
    > make some changes elsewhere.
    >
    > Of course, you might need to consider whether you are breaking the basic
    > rules of normalization that require you do not:
    > - store dependent data, or
    > - store redundant data.
    >
    > --
    > Allen Browne - Microsoft MVP. Perth, Western Australia.
    > Tips for Access users - http://allenbrowne.com/tips.html
    > Reply to group, rather than allenbrowne at mvps dot org.
    >
    > "Garret" <garretdoe@hotmail.com> wrote in message
    > news:1151512599.898144.156580@d56g2000cwd.googlegroups.com...
    > >
    > > Allen Browne wrote:
    > >> Why create all these buttons on each form?
    > >>
    > >> You can create a toolbar that has all the buttons you need, and assign it
    > >> to
    > >> the Toolbar of each form. Job done.
    > >>
    > >> Surely the toolbar, menu, and keyboard is enough without a command button
    > >> as
    > >> well:
    > >> - Save: Toolbar button. Records Menu. Shift+Enter on keyboard.
    > >> - Delete: Toolbar button. Edit menu. Del on keyboard (after selecting
    > >> record.)
    > >> - Find: Toolbar button. Edit menu. Ctrl+F on keyboard.
    > >> - Undo: Toolbar button. Edit menu. Esc on keyboard.
    > >>

    > >
    > > My command buttons for Save and Delete are customized to have popup
    > > boxes and affect some attributes on other forms.
     

Share This Page