JohnHarkins
MIS
When I set up an event to handle the not-in-list for a combo box, I first invoke a subform which lets me add the data to the lookup table. So far, so good. Since I wanted to pick up the value that the user entered and stuff it into the subform for the lookup table, I do something like this in the on-open event for the subform:
Me.txtPgmName.Value = [Forms].[sfrmLoookupTable].cboPgmName
...in order to stuff the new value that the user put in the main form that was not found in the list and then...
me.cboPgmType = null
me.cboPgmStyle = null
... to empty PgmType and PgmStyle and be ready for the user to put a value (or select it from a combo box).
First, there's probably a better way to handle this, but I'm not sure just how. Moreover, I'd like to be able to do a requery for the main form so that when I close out the subform, the main form will reflect the newly created values. Any suggestions?
Finally and most importantly, I want to be able to share the subform between adding a new record (as above) and changing a record. Why would I want to do that? Well, I thought I could save maintaining two separate forms that are the same except for the circumstance under which it is called. So, the problem becomes, how do I know that I am entering the subform to add a new record or modify an existing one? Do I interrogate end-of-file? Can I check some other property that would indicate that I'm sitting on an existing or new record?
Thanks!
John Harkins
Me.txtPgmName.Value = [Forms].[sfrmLoookupTable].cboPgmName
...in order to stuff the new value that the user put in the main form that was not found in the list and then...
me.cboPgmType = null
me.cboPgmStyle = null
... to empty PgmType and PgmStyle and be ready for the user to put a value (or select it from a combo box).
First, there's probably a better way to handle this, but I'm not sure just how. Moreover, I'd like to be able to do a requery for the main form so that when I close out the subform, the main form will reflect the newly created values. Any suggestions?
Finally and most importantly, I want to be able to share the subform between adding a new record (as above) and changing a record. Why would I want to do that? Well, I thought I could save maintaining two separate forms that are the same except for the circumstance under which it is called. So, the problem becomes, how do I know that I am entering the subform to add a new record or modify an existing one? Do I interrogate end-of-file? Can I check some other property that would indicate that I'm sitting on an existing or new record?
Thanks!
John Harkins