Link to home
Start Free TrialLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

asked on

Additional Design Help

Experts,
I thought that I had a working solution yesterday but if I did I don't see it. Here's my need:
Customer make loans
Each loan has a status, e.g. Open, Closed, Bankruptcy, etc.
Each status can have more than one reason, e,g, Bankruptcy, Chapter 7, or Chapter 11. I want to associate only that reason against the corresponding LoanStatus so people can not pick the wrong reason for a loan status (there can be multiple reasons against one LoanStstus.)
In my tblLoans the fields I'm interested in are:
LoanStatusID (fk)
ReasonForStatus (fk)
How can I build this?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

You simplest way is to create a table (tbl_Status_Reason) that contain two columns (Status and Reason) and contains all of the accepted combinations of Status and Reason.

Then, on your form, you use a query that looks like the following for a the Status combo box on your form.  This combo box would be bound to the Status field in your primary data table.

SELECT Distinct STATUS from tbl_Status_Reason

Then, the query that would be the RowSource of your Reason combo box would look something like the following:

SELECT Reason FROM tbl_Status_Reason WHERE [Status] = Forms!yourMainForm.cbo_Status

Finally,  in the After Update event of cbo_Status, you would requery the combobox cbo_Reason, so that it only displays the acceptable value for the selected Status.  That code would look something like:

Private sub cbo_Status_AfterUpdate

    me.cbo_Reason.Requery
    me.cbo_Reason = NULL

End Sub
Avatar of Frank Freese

ASKER

Let's take a look at the structure:
tblLoan                              LoanStatusReasonID (fk)
tblLoanStatusRdeason     LoanStatusReasonID (pk)
                                          LoanStatusID (fk)
                                          LoanReasonID (fk)
tblLoanStatus                    LoanStatusID (pk)
                                          LoanStatus
tblLoanReason                  LoanReasonID (pk)
OK?
                                          LoanReason
Will all the reasons be "canned" predefined reasons or will they be unique comments make by the user (or some mixture of the twoi?
each reason will be independent of the status, though you may have the same reason twice.
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
did you mean "reasons will be dependent on status"?

If they are independant of one another than you can associate any reason with any status and don't need tblLoanStatusReason.
I understand your suggesrtion this way:
tblLoan
    LoanStatusID (from the table tblLoanStatusReason as fk)
    LoanReasonID (from the table tblLoanStatusReason as fk)

Then the table tblStatusReason looks like this:
LoanStatusID (here the data comes from the table tblStatus)
LoanReasonID (here the data comes from the table tblReason)

I'd then create an unique index on LoanStatusID and LoanReasonID in the table tblStatusReason

same page?
actually, I have to associate a status with a particular reason. For example, if the status of the loan was Collections, I do not want to associate Collections with Chapter 7, with is a type of Bankruptcy
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks