Can't connect to iTunes because I've forgotten my password?

I had an iPhone 3G / 3GS a while ago and it had a passcode on it. Then I got a BlackBerry which has now broken, so I decided I wanted to go back to using the iPhone. The only thing is I've forgotten the passcode. I Googled what I should do and it said I have to connect the iPhone to iTunes and reset it. Which I was quite happy to do, but every time I connect it to the computer a message pops up saying it can't connect to iTunes because you need to type in the passcode, WHICH I DON'T KNOW. Can anyone help!

You're going to need to set your iphone in recovery mode.