Results of autocomplete field in form depending on another field - Drupal 7
Keep a wild card in your autcomplete menu path something like

function mymodulename_name_menu() {
  $items['example/autocomplete/%/%'] = array(
    'page callback' =&gt; '_mymodulename_autocomplete_callback',
    'page arguments' =&gt; array(2, 3),
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
  );
}


In your form

function mymodulename_my_form($form, &amp;$form_state) {
// Your select field.
  $form['select_field'] = array(
    '#type' =&gt; 'select',
    '#options' =&gt; array(
      'option1' =&gt; 'Option1',
      'option2' =&gt; 'Option2',
    ),
    '#ajax' =&gt; array(
      'callback' =&gt; '_mymodulename_ajaxcallback',
      'wrapper' =&gt; 'replace_autocomplete_field',
    ),
  );
  // A container field
  $form['autocomplete_field_container'] = array(
    '#type' =&gt; 'container',
    '#tree' =&gt; TRUE,
    '#prefix' =&gt; '&lt;div id="replace_autocomplete_field"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
  );
  $query_parameter = isset($form_state['values']['select_field']) ? $form_state['values']['select_field'] : 'default_value_to_start_with';
  // Your autocomplete field.
  $form['autocomplete_field_container']['autocomplete_field'] = array(
    '#title' =&gt; t('My autocomplete field.'),
    '#type' =&gt; 'textfield',
    '#autocomplete_path' =&gt; "example/autocomplete/$query_parameter",
  );
}


You Automcomplete menu callback

function _mymodulename_autocomplete_callback($query_parameter, $string) {
  // Use $query parameter to decide autocomplete field behavior.
}


Basically I am trying to update the autocomplete field by attaching '#ajax' behaviour to select field, and while updating the autocomplete field we will change the query parameter which db_query will use.