“The form cannot run the specified query” in InfoPath 2007 Forms Migrated to SharePoint 2010

InfoPath 2007 forms migrated to a SharePoint 2010 site may show this error. It happens when the form contains controls which populate data from a SharePoint list using the following URL in data connection.


The ULS errors being logged for this error would be,

 The form cannot run the specified query. The remote server returned an error: (400) Bad Request.)

A workaround for this problem is to modify the data connection and append “&noredirect=true” to the URL. So the resulting URL would look like