Peculiar Form Behavior

jkfeagle

Codus Confusious
Local time
Today, 05:32
Joined
Aug 22, 2002
Messages
166
I have a form with a subform on it. A field(combo box) on the form will determine the value of a field (text box) on the subform. (Basically its an auto-generated case number that uses the plant field on the form to determine the prefix). The code to automatically generate the next case number is in the On_Current for the form and the After_Update for the combo box on the form. The code appears to work correctly in generating the next case number. The peculiar behavior I'm seeing is that when I change the plant in the combo box, the case number on the subform updates correctly and then disappears!! If that wasn't wierd enough, if I type in data in the primary key field that links the two forms, my close button no longer works. The form is being opened in data entry mode if that matters. Anybody have any ideas??:(
 
Is the subform linked by recordsource criteria or by Master/Child properties? Do you requery the subform on the combo box AfterUpdate event?
 
Linked by recordsource criteria. No I wasn't using a requery. Would that work in data entry mode?
 
Sorry. The forms are linked Child/Master. I don't know why I said that before.
 
You've got to requery every time your Master field changes.
 
OK. I resolved the close button issue. That was a simple matter of the modified code I put behind it. (Dummy me only coded the error trap side of it and ignored the normal exit condition. Go figure) The form behavior is now different. I put the code assigning the case number on the before_update side of the subform. It works fine until I begin typing data on the main form and then all info on the subform disappears. I suspect it has something to do with the subform losing focus and saving the data but I'm not sure.
 
Is the data you're losing generated by your code? Is it stored somewhere in a table?

I've had the same problem in the past when trying to generate values w/ code and then putting them on a form w/o storing them in a table. I think I was able to reduce the problem by reordering the events in my code, but nothing ever solved the problem of things disappearing.

Sorry, I never really figured it out. I just associated it w/ Access being a quirky program not designed for heavy coding. I learned to work within a more limited scope when using Access.

I know I haven't answered your problem, but atleast you can be assured that you're not alone in your struggle.
 
Actually the data is being stored to the table and not just the data that's being generated by code but any data that happens to be on the subform. If/when I figure it out, I'll let you know.
 
I have figured out that this peculiarity only occurs when the Master/Child field (the field that links the two forms) is null when switching between forms. If the field has a value in it, then nothing happens. The only thing I can figure is that when the subform is deactivated and the main form is activated, it sees the linked field as being empty and since it is in Data Entry mode, assumes you want a whole new record. Hope that is of some help.
 

Users who are viewing this thread

Back
Top Bottom