Can anyone tell me what is wrong with this?
Run time error '2185'
You can't reference a property or method for a control unless the control has the focus.
Private Sub AssignButton_Click()
Dim SQLMasterUpdate As String
Dim oItem As Variant
If Me!RestaurantListBox.ItemsSelected.Count <> 0 Then
For Each oItem In Me!RestaurantListBox.ItemsSelected
SQLMasterUpdate = "UPDATE Restaurant SET " & _
"Restaurant.AccountManagerID = (SELECT AccountManagerID FROM AccountManager " & _
"WHERE AccountManagerName = " & Me!AccountManagerName.Text & ") " & _
"WHERE ((SELECT RestaurantInfo, RestaurantPhone FROM Restaurant) = " & oItem & ");"
DoCmd.RunSQL SQLMasterUpdate
Next oItem
Else
MsgBox "Nothing was selected from the list", vbInformation
Exit Sub 'Nothing was selected
End If
End Sub