In this post I'm going to answer the same question that has been answered already but give you a more flexible way to do it... How to Remove the Add Existing button...
This basic technique can be used for much more than just removing that evil Add Existing Button that we all hate so much :)
It follows that all the solutions out there basically do the same thing, they wait for the IFrame to be loaded on the form and then they "adjust" the DOM within that IFrame. This technique does the exact same thing, well… almost. I'm going to show you how to remove that button but you can replace or enhance that code to do anything you want, it's up to you. This solution just fires an event handler that you setup whenever that IFrame's DOM is loaded and ready to be used.
I'm going to extend the example I used in my last post: The Account entity has a 1:N parent/child relationship with a custom "Building" entity. In the last post I showed you how to put the Associated View on the main form, this code will work for both associated views (I don't think the other examples on the internet will, correct me if I'm wrong).
Also, I'm going to use the readily available LoadFile method that someone else had already created and posted to the internet. There is one important adjustment to make it work with Server 2008 and R2; the cache date must use a two digit day, so instead of "Sat, 1 Jan 2000 00:00:00 GMT" It needs to be: "Sat, 01 Jan 2000 00:00:00 GMT"
Step 1: Take the attached FrameElement.js file and copy it to a file in the ISV folder. I'm not going to bother to explain how it works or why, I doubt most of you would be interested. But if you are, feel free to look at it and ask me whatever questions you want.
Step 2: We need to get the nav link's element ID of the associated view. So open up an Account record and Ctrl+N to get access to the toolbar. Then open the Dev Toolbar.

Click to select the navigation link and copy the A element's ID. We need to use it in our JavaScript.
Step 3: We also need the actual IFrame's ID as well.

Click to select the area just to the left of the Associated View's Grid, then locate the parent IFrame and copy the ID.
The ID for the Grid on the main form is going to be IFRAME_Buildings because that's what I named it when I created it in my last post :)
Step 4: Get the Add Existing Button's ID

Step 5: Open the Account form and place the following code in the OnLoad event:
function LoadFile(url, cache) {
var httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
httpRequest.open("GET", url, false);
if (!cache) {
httpRequest.setRequestHeader("If-Modified-Since", "Sat, 01 Jan 2000 00:00:00 GMT");
}
httpRequest.send(null);
return httpRequest.responseText;
}
// load the file into memory space
eval(LoadFile("/ISV/custom/javascript/FrameElement.js", true));
// hide the button in the normal associated view
FrameElement.GetWhenReady('nav_ims_account_ims_building', 'ims_account_ims_buildingFrame', RemoveAddExistingBuildingButton);
// hide the button in the IFrame associated view on the form
FrameElement.GetWhenReady(null, 'IFRAME_Buildings', RemoveAddExistingBuildingButton);
// FYI: There is nothing to stop you from doing anything you want with the doc's DOM; this is the DOM inside the IFrame
function RemoveAddExistingBuildingButton(doc, args) {
var addExistingElement = null;
addExistingElement = doc.all._MBtoplocAssocOneToMany10002imsaccountimsbuilding;
if (addExistingElement) addExistingElement.parentElement.removeChild(addExistingElement);
}
Final Product:


Enjoy!
PS. Did I mention that this is totally unsupported?
Here is the link to the FrameElement.js file