Solved

Need Help Trying to Implement a Parent - Child UI and Business Logic

Posted on 2006-06-26
1
181 Views
Last Modified: 2010-04-30
I am about ready to abandon what I've done and just add additional [Edit] buttons to the form. I would blame the 'fuzziness' on my meds, but all five of my doctors tell me I am perfectly normal :-)

I have an Employee class. Within this class, amongst all the other methods and properties, are three collections, one for Work phone numbers, one for Personal phone numbers and one for Addresses. An employee can have a primary, secondary, cell, pager, fax number, and separate home and mailing (as well as an alternate) addresses.

When the user goes into Update mode, all fields become updatable. The main one I am having problems with is the address. By default, the edit form displays the first available address (assume Home). There is a read-only combo box to the left of the address textboxes. The user can drop down the combo and chose Home, Mailing or Alternate. If an address exits for that address type, I retrieve a class with the properties and populate the text boxes. If no class exists in the collection, I create a new one, populate it with the address type code, and allow the user to enter data.

My main problem is determining how (and when) to handle getting all the data back into the collection. My thinking is way too much inside the box and for some reason I am having trouble visualizing this, handling data validation, the best way to handle persistence (as it stands now, it is an all or nothing scenario. The user makes all the changes they want, and when done, clicks [Save] - assuming all data is valid and [Save] has become enabled.

As I stated, one stumbling block I have encountered is what to do with the class that has been updated, in getting it back into the collection. If it is a new address, I have no problem as I have an AddAddress method on the collection that I pass a class to and it is added. Would it be appropriate to have an UpdateAddress method that accepts a class, finds the matching key in the collection and updates the properties one at a time? I guess with all my programming, I have never run across this scenario.

Would the experts recommend that I break apart validation of the main employee data from the address validation so the primary data can be saved even if an address is invalid and allow the user to then go in and correct the address (invalid address data would not be saved, it would just be ignored when other data was saved). Programming the way the user wants it can get to be a BIG pain.

Like I said at the start, part of me wnats to put an [Edit] button next to the address and then bring up a separate form to enter info. That would certainly help with the issue of knowing when to allow navigation away from the address data and if they do not get the address right, their only option is to click [Cancel] and go back to the main form.

Oh, great SAGES of the VB Code! Shed thy wisdom upon me!
0
Comment
Question by:dbbishop
1 Comment
 
LVL 13

Accepted Solution

by:
jmundsack earned 500 total points
ID: 16987458
I have run into this situation a lot--users wanting to update what is effectively child info directly on the parent info screen--and I always opt for the modal child form.  I let them view the child info read only, select between the various child records, and then have buttons to add, edit and delete.  It may not be exactly the way the user wants it, but it's usually way too much of a pain in the tuckus to deal with the other way.  The nearest compromise I've ever done (which was aggravating enough), was to simulate a modal form by having an editable set of controls appear in the same place as the read-only controls, while disabling every other control on the parent form.  But ultimately the result is the same: you want to edit child info, then you run a function to begin the edit, and then either save or cancel the edit.

HTH-Jon
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question