0
votes

i have created forms which use queries to manipulate and show data, these queries have [criteria] which is taken from a combo box \ text field in the form. it runs perfectly when i execute the form alone, however when executing it from the MainNavigationForm (tabbed navigation style) it pops-up the "enter criteria" dialog that you usually get when you specify a criteria without any source - like empty brackets []. i am posting the VB code behind both forms, both behave the same way, and pop the dialog for criteria when launching them from the main navigation form, the first form has more code because it updates the query and values in another combo box based on the value of the first combo box. the second form just runs the query again when value in the combo box is changed.

thank you for your help.

 Option Compare Database

Private Sub Command23_Click()
DoCmd.OpenQuery "QryMaintProgPlan", acViewNormal

End Sub

Private Sub id_combo_AfterUpdate()
DoCmd.ShowAllRecords
DoCmd.FindRecord Me!id_combo

  Me.maint_combo.Requery
  Me.emp_combo.Requery


End Sub

Private Sub maint_combo_AfterUpdate()
Me.emp_combo.Requery
Me.EmployeeID = emp_combo.ItemData(0)


End Sub

2nd form :

Option Compare Database

Private Sub btn_requery_Click()
DoCmd.ShowAllRecords
End Sub
1

1 Answers

1
votes

Ok, i have found the answer, i was supposed to use the adress of the navigationSubform in the query criteria because once i launched it from the navigationForm it no longer used the same adress. [Forms]![frmMainNavigation]![NavigationSubform]![id_combo] is the correct one instead of [Forms]![frmMaintProgPlan]![id_combo].