Is there a simple way of populating dropdown in this Access Database schema?

It is a very bad idea indeed to name anything Name.

It seems to me that you need cascading comboboxes. You will need a little VBA.

Two combo boxes called, say, cboLocation and cboNodes, on a forrm called, say, frmForm

cboLocation

RowSource: SELECT ID, [Name]
FROM Locations
ORDER BY [Name]

ColumnCount: 2

ColumnWidths: 0;2.00cm  ''The second column can be any suitable width

LimitToList: Yes

Events:

Private Sub cboLocation_AfterUpdate()
    Me.cboNode.Requery
End Sub

CboNode

RowSource: SELECT ID, NodeName
FROM Nodes
WHERE IP=[Forms]![frmForm]![cboLocation]
ORDER BY NodeName

ColumnCount: 2

ColumnWidths: 0;2.00 ''Ditto

LimitToList: Yes

Events:

Private Sub cboNode_GotFocus()
    If Trim(Me.cboLocation & "") = vbNullString Then
        MsgBox "Please select location"
        Me.cboLOcation.SetFocus
    End If
End Sub

You will also need a form event:

Private Sub Form_Current()
    Me.cboNode.Requery
End Sub

Leave a Comment