It is a very bad idea to actually name something Name.
It seems to me that you need cascading comboboxes. You will need a little VBA.
Two combined blocks, called, for example, cboLocation and cboNodes, in forrm, called, for example, 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
Developments:
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
Developments:
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
source share