Help building a Data Entry Form with multiple filters

Anonymous
2025-01-13T14:56:20+00:00

I'm building a database for audit results. I've got the following tables:

Site (list of sites)

Audit Host (list of hosts)

Client (List of clients)

Audit Number (creates an audit associated with a client, site, and host selected from the lists above)

Classification (list of classifications)

Observation (associated with an audit number and a classification selected from list above)

Response (associated with a specific observation)

So each audit will have an audit number. Each observation will be associated with an audit number and will have a classification entered as a dropdown selected from the classifications table. There can be more than one observation per audit, but each observation will have its own ID. I have built forms that allow people to enter new audits and observations and to add new options to the list tables.

What I need help on is building a form to enter a response to the specific observation. Ideally I would like them to be able to select an audit number from the dropdown and then select the specific observation that the response is addressing. I would like for them to be able to see the text of the observation pulled in from the observation table as well. I tried to show my relationships diagram, but I get an error when trying to upload the image or paste a screenshot.

Any help would be appreciated.

Microsoft 365 and Office | Access | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Duane Hookom 26,555 Reputation points Volunteer Moderator
    2025-01-13T15:27:10+00:00

    This sounds similar to an order entry system with a main form based on the Order/Audit and a continuous subform to enter the Order Details/Observation. The response would be similar to quantity in the order entry. This is modeled well in the new Northwind templates.

    0 comments No comments
  2. Anonymous
    2025-01-13T15:51:14+00:00

    Thank you. I'll check this out.

    0 comments No comments
  3. ScottGem 68,775 Reputation points Volunteer Moderator
    2025-01-13T17:38:00+00:00

    I would create an unbound form with 2 unbound comboboxes. The first combo would select an Audit Number. This would then filter the second combo to a list of observations for that audit. Then a button to open a form filtered to that Observation.

    Without knowing the actual structure of your tables. the following is just a guess but should give you an idea to go on

    frmSelObservation

    cboSelAudit

    RowSource: SELECT AuditNumber, AuditDescription FORM tblAuditNumber ORDER BY AuditDescription;

    Column Count: 2

    BoundColumn: 1

    After Update event

    dim strSQL as String

    strSQL = "SELECT ObservationID, ObservationTitle FROM tblObservations WHERE AuditNumber = " & Me.cboSelAudit & ";"

    Me.cboSelObservation = strSQL

    Me.cboSelObservation.Requery

    cmdOpenObservation

    DoCmd.OpenForm "frmObservation",,,"ObservationID = " & Me.cboSelObservation

    0 comments No comments
  4. Anonymous
    2025-01-13T17:40:37+00:00

    This sounds like a candidate for the use of correlated combo boxes, the first to list the audits, the second to list the classifications related to the selected audit number.  You'll firstly need a table to model the relationship type between classifications and audit numbers, ClassificationsAuditNumbers say.

    The RowSource property of the classification combo box would be along these lines:

    SELECT DISTINCT Classification.ClassificationID, Classification 
    
    FROM ClassificationsAuditNumbers INNER JOIN Classification 
    
    ON ClassificationsAuditNumbers.ClassificationID = Classification.ClassificationID
    
    WHERE ClassificationsAuditNumbers.AuditNumber = Form!cboAuditNumber 
    
    ORDER BY Classification;
    

    The combo boxes would be unbound, and  could be placed in a form, in single form view, based on a query on the observations table, restricted by parameters which reference the unbound combo boxes.  In the AfterUpdate event procedure of the classification combo box the form would be requeried to return only the observation(s) on the audit/classification selected.  If you want to prevent users entering a new observation set the form's AllowAdditions property to False (No).  If you want to prevent them editing an existing observation set the Locked property of the observation text box control to True (Yes) and its Enabled property to False (No).

    Within the form would be a subform based on the Response table, linked to parent form on ObservationID or similar as the LinkMasterFields and LinkChildFields properties of the subform control.  The subform would thus, by default, allow one or more responses to be made to the observation currently showing in the parent form.  If you want to limit the subform to the entry of only one response per observation, create a unique index in the Responses table on the ObservationID column.  This will make the relationship type one-to-one, so an error would be raised if a user attempts to enter a second response to an observation.

    The form's RecordSource would be a query along these lines:

    SELECT *
    
    FROM Observations
    
    WHERE AuditNumber = Forms!frmObservations!cboAuditNumber
    
    AND ClassificationID = Forms!frmObservations!cboClassification
    
    ORDER BY ObervationDate DESC;
    

    With this example the observations per audit/classification would be returned in the form in descending date order, but the observations could be returned in whatever order you wish of course.

    The AfterUpdate event procedure of the audit combo box would be:

        Me.cboClasification.Requery
    
        Me.cboClassification = Null
    

    And that for the BeforeUpdate event procedure of the classification combo box would be:

       Const MESSAGE_TEXT = "An audit number must be selected first."
    
        If IsNull(Me.cboAuditNumber) Then
    
            MsgBox MESSAGE_TEXT, vbExclamation, "Invalid Operation"
    
            Cancel = True
    
        End If
    

    The AfterUpdate event procedure of the classification combo box would be:

        Me.Requery
    
    0 comments No comments
  5. Anonymous
    2025-01-13T17:56:32+00:00

    Thank you. I wanted to filter by audit and then by observations associated with that audit. Just wasn't sure how to do it. The unbound combo boxes with the afterupdate on the audit combo box event sounds like the way to go. I appreciate the suggestion on how to limit it to one response per observation as well. It should be one-to-one

    0 comments No comments