Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Making a code shorter and more efficient (MS Access 2007)

    In my databaseprogram i use a form 'frmArticles' to manage current-Articles as well as ex-Articles.
    In order to help me find quickly an article, i have six comboxes in the header of my form, three for the current articles and three for the ex-articles.
    See my code below.
    The code i use in the after update event, as well as in de On-Click event of this comboboxes, is for all of this six comboboxes nearly the same.
    Therefore i have the fealing that all of this code can be reduced to only one or two routines that does the same as my code, but is applicable to all of this comboxes.
    However, i can 't figure out exactly how it has to be done.
    As you can see in my code, i also use a errorhandling routine. When a error occures, i get a message about what's going on. So far so good.
    However, after closing the errormessage, Ms Access get blocked, and i have no mean to get out.
    What can be done to make this erroroutine works such a way, that after closing the error message, i can correct the error and go on?

    My Code:
    Very long piece of code moved to attachment by HansV
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Making a code shorter and more efficient (MS Access 2007)

    Does the code work at all? If Artikelomschrijving (Dutch for "Article description") is a text field, you'd need to place quotes around the search value.

    Your code calls an error handling procedure named foutbericht, but you've posted a routine named HandleError whose arguments are in a different order than those for foutbericht.

  3. #3
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Making a code shorter and more efficient (MS Access 2007)

    I must admit that i did not test this code for what about the form 'frmArticles', but i can say that the same kind of code is also used in the form 'frmClients" where it realy works. I just copied the code from the frmClients to the frmArticles, and still have to make the neccesary correction. My goal is,to give a idea of how my code looks like and to know how te reduce this code. For the moment i have some other work to do,but this evening, as soon as i can , I will make a copy of the working code and send it up. As you will see, it is just the same as the one i putted in my question, but this time a really working one.
    What about the errorhandling, I will look for the code in my program and make the necesary correction.

    Thank you very much.

  4. #4
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Making a code shorter and more efficient (MS Access 2007)

    As promised, here the code that works. Also what about the errorhandler, the one i sent the first time is the wrong one. In the code below i have also put the wright errorhandler that gives me
    the problem i told you before.

    Once again, very long piece of code moved to attachment by HansV <img src=/S/sigh.gif border=0 alt=sigh width=15 height=15>
    Attached Files Attached Files

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Making a code shorter and more efficient (MS Access 2007)

    I can't test the code of course, but try the attached version. It's less than half the size of your code.
    Attached Files Attached Files

  6. #6
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Brugge, Belgium
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Making a code shorter and more efficient (MS Access 2007)

    I must admire you for your knowledge about MS Access. You are realy a valuable help for a lot of us. Thank you very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •