title: Access query asks for a year and month again
body: <p>I have a VBA code that checks if there are data in a year and month the user inputs, and by that it decides to which query to send the user.
  this is the code:
         Sub macro1()</p>
  
  <pre><code>   Dim dbs As DAO.Database
     Dim qdf As DAO.QueryDef
     Dim qdf2 As DAO.QueryDef
     Dim year As Integer
     Dim month As Integer
  
     Set dbs = CurrentDb
     Set qdf = dbs.QueryDefs("äëðñåú äåöàåú")
     Set qdf2 = dbs.QueryDefs("äëðñåú äåöàåú àí àéï èåøðéø áçåãù")
  
     year = InputBox("What year would you want to get data from?")
     month = InputBox("What month would you want to get data from")
  
     If Not IsNull(DLookup("[÷åã èåøðéø]", "[àãîéðñèøöéä ùì úçøåéåú]", "DateDiff('m', [úàøéê çæøä îäèåøðéø], DateSerial(" &amp; year &amp; ", " &amp; month &amp; ", 1)) = 0")) Then
     qdf.Parameters("[äëðñ ùðä]") = year
     qdf.Parameters("[äëðñ çåãù]") = month
     DoCmd.OpenQuery "äëðñåú äåöàåú", acViewNormal, acReadOnly
     Else
     qdf2.Parameters("äëðñ ùðä") = year
     qdf2.Parameters("äëðñ çåãù") = month DoCmd.OpenQuery "äëðñåú äåöàåú àí àéï èåøðéø áçåãù", acViewNormal, acReadOnly
     End If
     End Sub
  </code></pre>
  
  <p>The code works perfectly except that it doesn't input the year and month for the query, which means the user needs to enter the data twice, and he can enter different data on the second time, which doesn't solve the porblem.
  I think the main reason is that both querys are built from other querys (because there relationship is to complicated to do on 1 query)</p>