First thing to do is check the connector between the door and 'A' pillar. There may be a bad contact there. Separate the connector ( turn the knurled ring ) and check it for damage. Reseat it a few times and then do it back up. See if that has fixed the problem.
If not, remove door card ( explained elsewhere I won't reiterate ).
If you just need a workaround so you can drive the car in the drought we're having (
) the easiest way is to disable the window completely.
At the front of the door are two holes ( one where the speaker sits ). Locate the motor through those holes. At the top of the motor is a plug going into the motor body. It's the connector with the blue weather seal in this photo ( your car may have a different colour of course! ).
Unplug it and the window is disabled.
To investigate, first check there's nothing obviously wrong with the microswitch ( dirt grit etc jamming it ).
Find this hole in the door skin -
You can just see the roller of the microswitch at the bottom left of the hole in the bend of the actuating cam. The microswitch itself looks like this
The orange bit surrounds the plunger and you can see how the roller operates it. Press the roller to the microswitch body and the switch can be heard clicking on the way.
If all seems well then the problem is either inside the switch ( needs to be replaced as it is IP67 sealed ) or the wiring.
If you want to keep the window operating but just override the autodrop then find the connector visible in this photo in the speaker hole and the hole above it.
Seperate the connector and you want the long half. Inside you'll see two pins. Get a paperclip ( unpainted! ) or something similar and bend it as necessary so you can slip it over the pins with a snug fit without damaging them. Stuff in some blu-tak or similar so the paperclip doesn't fall out. Tape the two connector parts to the door skin so the window doesn't catch them when moving.
Now, the window will still operate as normally but won't drop when the door is opened. If the window does still drop when the door is opened you have a wiring fault.