Hi davegri. Thanks for reply.
In the Save button event I create such code
Code:
stCriteria = "FacilityID = " & !FacilityID & " AND BuildingID = " & !BuildingID & " And WingID=" & !WingID & " And FloorID=" & !FloorID & " And Room='" & !Room & "'"
If DCount("*", "tblLocations", stCriteria) > 0 Then
MsgBox "This location already exist." & _
vbCrLf & "Please enter a different location.", vbOKOnly + vbExclamation, _
"Duplicate Found"
Else
MsgBox "Not a duplicate"
End If
It give correct message:


But I would like to show in the message box information about location that are text values selected in the combo boxes. For instance, "The location NYU MB A1-2"
where NYU - Facility; MB - Building; A - Wing; 1 - Floor; 2 - Room are values selected in the combo boxes.
How to get such text in the message box?
When I tried code like this:
Code:
stCriteria = Me.cboFacility.Text & " " & Me.cboBuilding.Text & " " & Me.cboWing & Me.cboFloor & "-" & Me.txtRoom.Text
I got error message "Run-time error '2185': "You can't reference a property or method for control unless the control has the focus."
How to solve the problem?
Thanks.