Unanswered: Trying to find the best way to open a form - whether with a new record or not...
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?
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.
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.