Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    59

    Unanswered: Trying to find the best way to open a form - whether with a new record or not...

    Hi,
    I'm hoping for a bit of advice on this, as I'm in a spot of confusion over how to use my form when it opens.

    Basically, at the moment I have an OnOpen event on my form, which causes the form to go to a New Record. This is good as it means that when the form opens up it is blank.

    However, it produces one problem. I have 2 drop-down boxes and a button on this page. These combo boxes are used to enter 2 pieces of information. Once that is done, the button is pressed and if there is also a record using these two variables it goes to that record. However, if there is not it creates a new record.

    Because of the way my form is set-up as soon as any information is entered into either of these two fields, a new record is created. If it turns out there is already a record with these variables it will go to that record but it means a blank record will already have been entered.

    The other option is to run the add new record function later once the button has been pressed, but this would mean that the information entered in the 2 combo boxes will be wiped when the new record is created. It also means when the user first opens the form there will instantly be a record on show, which could be confusing.

    Does anyone have any suggestions regarding this issue? Is there a fix I could use or some way I could work around this?

    Thanks!

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Huh? o_0

    If the two combo boxes are meant to enter data then they should NOT be used for searching.

    If the two combo boxes are meant to do searching, then they should NOT be bound to fields.

    What is the intention for those two combo boxes? Data entry or searching? It cannot and should not be both.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Nov 2008
    Posts
    59
    Okay,
    So this probably answers my question. For me, as I want to use the form for first a search and then data entry it seemed like the most obvious way was to use these combo boxes for both of these actions.

    Would the solution to this then be to have two sets of combo boxes, one for searching and one for data entry, and then have an OnClick event on the button which would move the values from the search combo boxes to the data entry combo boxes?

    I will give this a try. Let me know if there are any better solutions.

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    That solution is certainly going to be better than trying to use the combo boxes for two purposes.

    However, after the search, don't set the two data entry combo boxes themselves, but rather, their default values. Otherwise, after a search, two of the fields will be modified, successful search or not.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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