Strange problem with autocomplete field in forms in Drupal 7
I have finally completely solved the issue. I copy the code which is working and below the code which was giving the error. Please some expert on Drupal to verify if I am right:

Working code:
 $items['especialURL/autocomplete/%'] = array(

'page callback' => '_mymodule_autocomplete' ,
 'page arguments' => array(2,3,4),

Wrong code:

$items['especialURL/autocomplete'] = array(
   'page callback' => '_mymodule_autocomplete' . '/' . arg(2) .'/'.arg(3) . '/' . arg(4),

Explanation: the wrong code worked perfectly but once I cleared cache, it stopt working. Somehow the page callback was registered until the cache was emptied, and from that moment it would stop working. Maybe starting with page callback in the form of _mymodule_autocomplete and later adding the args() would work for a while. Interesting. These have been the worst 5 hours of my life working with Drupal due to using the wrong code while I had got it to work just by chance!!!