I'm currently working on a database that stores information related to court orders.
My current setup is a table (tblDocketInfo) that contains an individual records of the court orders each time one comes in, including the ID autonumber, the Docket Number, the Letter Date, as well a 5-digit case number that is the foreign key to a client table, a foreign key for the judge table, and other pertinant info.
Since each client can have more than one attorney assigned to them, I have a lookup table that relates the AttorneyID autonumber on the table of attorneys to the RecordID of tblDocketInfo. This information for the attorney's assigned to each case is displayed in Datasheet view in a subform of the form which displays the docket info.
On this same form, the Docket Number field is a combo box that uses a query to retrieve each retrieves all unique existing docket number for the given Client case# and allows the user to select one. If they do, the following VBA code is applied to several fields on the form:
The lookup query DocketFill does the following:
This checks the most recent entry on the DocketInfo table and carries over any existing values from the most recent previous Court order for use in the new record.
I would like to also carry over any existing attorney's that are assigned to that previously existing record and have them be displayed in the subform (or added to the .
What would be the best way to accomplish this?
My current setup is a table (tblDocketInfo) that contains an individual records of the court orders each time one comes in, including the ID autonumber, the Docket Number, the Letter Date, as well a 5-digit case number that is the foreign key to a client table, a foreign key for the judge table, and other pertinant info.
Since each client can have more than one attorney assigned to them, I have a lookup table that relates the AttorneyID autonumber on the table of attorneys to the RecordID of tblDocketInfo. This information for the attorney's assigned to each case is displayed in Datasheet view in a subform of the form which displays the docket info.
On this same form, the Docket Number field is a combo box that uses a query to retrieve each retrieves all unique existing docket number for the given Client case# and allows the user to select one. If they do, the following VBA code is applied to several fields on the form:
VBA Code:
If Me.NewRecord Then
txtLastCourtDate.Value = DLookup("[LastCourtDate]", "[qlkpDocketFill]")
txtReportSubmitDate.Value = DLookup("[ReportSubmitDate]", "[qlkpDocketFill]")
cboCounty.Value = DLookup("[CountyID]", "[qlkpDocketFill]")
cboJudge.Requery
cboJudge.Value = DLookup("[JudgeID]", "[qlkpDocketFill]")
txtNotes.Value = DLookup("[CourtUpdates]", "[qlkpDocketFill]")
End If
The lookup query DocketFill does the following:
SQL:
SELECT TOP 1 tblDocketInfo.RecordID, tblDocketInfo.DocketNumber, tblDocketInfo.[Case#], tblDocketInfo.LetterDate, tblDocketInfo.CommitID, tblDocketInfo.CommitDate, tblDocketInfo.LengthID, tblDocketInfo.LastCourtDate, tblDocketInfo.ReportSubmitDate, tblDocketInfo.NextCourtDate, tblDocketInfo.CountyID, tblDocketInfo.JudgeID, tblDocketInfo.CourtUpdates
FROM tblDocketInfo
WHERE (((tblDocketInfo.RecordID) In (SELECT TOP 1 RecordID
FROM tblDocketInfo AS Dupe
Where Dupe.DocketNumber = [Forms]![frmDocketInfo]![cmbDocket]
ORDER BY Dupe.RecordID DESC)))
ORDER BY tblDocketInfo.RecordID;
This checks the most recent entry on the DocketInfo table and carries over any existing values from the most recent previous Court order for use in the new record.
I would like to also carry over any existing attorney's that are assigned to that previously existing record and have them be displayed in the subform (or added to the .
What would be the best way to accomplish this?