I have a continuous form for vendor part data. When users are adding parts I would like the system to check the model number to see if it exists for that vendor and then tell tham it is a duplicate record.
At this point I want the message box to give them the option to edit the record or go to the existing model number.
I have everything working except the part about going to the existing record. I had intended to use the find record box to have the person go to the record. However, it will not work as it wants me to save my current record which it can't do because it violates the primary key.
Now I figured, fine, I'll just use the esc key sequence to get to the point where the potential record has been escaped from, then it should go to the find form, no problem. Nope. It will esc all right, then even though I can go to the find form directly from the form, I can't make it do so in code. SO my escape sequence works just fine at returning the form to the right state, it is just that the command to run the find form,
seems to pull the value that is no longer in the record (because I escaped out of it) and tries to save it before opening the form.
So I say, I'll try running the undo record command.
Nope. It tells me that the record can't be undone in this state. Grrrr.
Now all this is happening in the field BeforeUpdate event. Is there a better event to try or a better method for doing this or should I just be satisfied with clearing the record and let the user do a manual find if he or she wants to go to the existing part to edit it?
Any thoughts would be helpful as I am out of ideas to try. If anyone has succeeded in doing this, I would be interested in knowing the approach they took.
Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
At this point I want the message box to give them the option to edit the record or go to the existing model number.
I have everything working except the part about going to the existing record. I had intended to use the find record box to have the person go to the record. However, it will not work as it wants me to save my current record which it can't do because it violates the primary key.
Now I figured, fine, I'll just use the esc key sequence to get to the point where the potential record has been escaped from, then it should go to the find form, no problem. Nope. It will esc all right, then even though I can go to the find form directly from the form, I can't make it do so in code. SO my escape sequence works just fine at returning the form to the right state, it is just that the command to run the find form,
Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
So I say, I'll try running the undo record command.
Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Now all this is happening in the field BeforeUpdate event. Is there a better event to try or a better method for doing this or should I just be satisfied with clearing the record and let the user do a manual find if he or she wants to go to the existing part to edit it?
Any thoughts would be helpful as I am out of ideas to try. If anyone has succeeded in doing this, I would be interested in knowing the approach they took.
Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief