Error Trapping between Forms

Uvuriel03

Registered User.
Local time
Today, 15:22
Joined
Mar 19, 2008
Messages
115
I have a database I'm setting up with two main functions--Entering new receipts, and entering new shipments.

For the new receipts, I need a way to be able to enter new parts. For both new receipts and new shipments, I need a way to be able to enter a new order number and a new truck number.

The main forms have some information that auto-fills upon opening (like the new pallet number--it's always one number higher than the last one, so I just have it auto-fill into the appropriate field). I also have buttons on the main forms that, upon clicking, open another form for entering the information for the new truck/order number/part.

I'm wondering if A) there is an effective way to error-trap the receipt and shipment forms. When either of them lose focus (when a button is clicked and a new form is opened), whatever data that was already entered gets auto-saved. If the user then decides they don't want to save that information, I'm having trouble making sure the tidbits of data that got auto-saved then gets deleted out of the receipts table.

Or B) if there's a simpler way of desigining my database to avoid having this problem altogether.

I hope I explained this well enough, I tried to keep it simple. If anyone needs more detailed explaination, I can provide.
 
Last edited:
I'm not sure this is a direct answer to your question, but if you're doing what I think you're doing, I suspect the most common method of handling it is the Not In List event of a combo. Presuming your user is entering values into a combo box that is populated with the existing choices, you use the Not In List event to trap when they add a new value. If there are more fields that need to be entered than the one entered into the combo (part description, vendor, whatever), you open a new form in dialog mode so the current form stops and waits for the data to be entered. If that sounds like the kind of thing you want, searching for "notinlist" should turn up the various methods.
 
Pbaldy,

Thanks for your response.

I'm not having a problem with the actual combo boxes or anything. (If I need a combo box to be limited, I know how to do that within its properties.) The reason for the buttons for new parts/trucks/order numbers is so that the user can enter all the applicable information for the given new item on the appropriate form, into the appropriate table.

The problem I was having was with the auto-saving when the main form loses focus. I'll look into the thing you said about opening a new form in dialogue mode though, I had never really researched the differences between how a form opens. If I could just effectively put the old form on pause, rather than have it auto-save the existing data, that would be perfect!

Assuming this works how I think it might, how could I update a combo box's data without having to autosave what's already on the form (like with refresh)?
 
I'd go ahead and search on notinlist. There are methods that include opening another form to add the related data, then coming back to the original form with the new item in the combo. The original form waits for the new form to close, so it's as if you never left it.
 
No problem; let me know if you get stuck.

I have to say your avatar always makes me do a double-take. It looks a little like my younger daughter. Not close enough to say it's a twin, but close enough to make me look twice.
 
Hah, how odd! I've been meaning to change it, anyway. I really like the picture, but I've cut my hair since then. =P It's not often I have people telling me I look like anybody! ^_^
 
See, now that one is different enough that I wouldn't do the double take. I guess it was partly the pose or the look. I'll see if I can dig up one of her in a similar pose to your previous pic, so I can see if I'm just on drugs or something. Can you post the other one again for comparison?
 
*chuckle* Sure. Here:

Small.jpg
 
All right, I'm probably on drugs, but here's one in a similar pose (how did you get the pic right in the body rather than an attachment?). Thanks for humoring an old man. :p
 

Attachments

  • CB.JPG
    CB.JPG
    4.3 KB · Views: 194
I hosted the picture on a file hosting site (FileDen.com, ftw!) and just put the link directly to the picture in the body.
 
Your suggestion to use the NotInList even is working AMAZINGLY. I'm going through all of my forms right now and adjusting them all to use this procedure. WAY better than the scrappy error-trap I was trying to throw together.

Thanks a bunch!
 
I have a suggestion but maybe it to late since you already have redone the forms but anyway here it is. With this method you dont have to worry about anything.

Create a button or label control next to the combo box that says add. on click button or label add open the form they fill in but open it in dialog mode then do a requery on the combobox.

The openform in dialog mode will halt the execution on opening of the form so when you done adding the new record the requery will kick in and you will have that option available in your combobox.

This is a much cleaner approach IMO.
 
I'm going to respectfully disagree. The average user isn't going to know in advance whether the value exists or not, so they're likely to key it into the combo, at which point you'll hit the not in list event anyway. They'll have to clear the message box that advises them the value wasn't in the list, and then have to click this extra button (which also adds clutter to the form). That button would open the same form in dialog mode that the not in list event would have opened, plus the user would have to go to the combo and select the newly added value, unless you code that. It seems like more steps to do it that way, unless I'm missing something (and on Friday afternoon, that's a strong possibility).
 
with current theory it will work if the user add one item only. if the user add more than one item which item should be selected?. It may be more clutter but at least the user is aware of what is going on. On the note of that. if the user decide to use the combo box and not type anything in the combo box. The code for not in list will never be fired and the user will a not be able to add new items to combo box.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom