If you ever wondered how you can do this “without code” J you can do it by placing two WebParts on a SP page; an InfoPath Form WebPart and a Query String Filter WebPart. You then make a connection between the two passing the value from the Query String Filter to the InfoPath form WebPart.
Note the following:
- This will not work for “lookup” fields if you use the default SP list InfoPath form (That’s Why I thought you can’t do it originally for lookups). However, you can expose the “lookup” dropdown field if you create a new InfoPath form using the method below.
- Make sure you add the “field” in your InfoPath to the list of allowable fields to be used in connections.

References:
And here is how you can do it with Code behind.