Hi,
I have 2 forms, one is an update form and the other is an identical form copied from the 1st form used to add new records. There are 2 forms due to less fields and security. The update form works fine but the new form does not. There is a combobox (Division_Name) whose RowSource depends on the value selected in another combobox (GMM_Name). In both forms the RowSource for (Division_Name) is as displayed below but on the new form the "enter parameter" dialog displays for the GMM_Name:
SELECT tbl_T133M_GMM_DIV_SDV.DIVISION FROM tbl_T133M_GMM_DIV_SDV WHERE
(((tbl_T133M_GMM_DIV_SDV.GMM_NAME)=[Forms]![form_New_PSSA_Tracker_Request]![GMM_Name])) GROUP BY tbl_T133M_GMM_DIV_SDV.DIVISION;
I tried Me!GMM_Name and Me.GMM_Name, I also saved the form first, I also tried inline SQL to set the RowSource. Below is my latest code:
Private Sub GMM_Name_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.Save acForm, "form_NEW_PSSA_Request" 'saving form in case field not saved after entered
Debug.Print "GMM_Name = "; Me.GMM_Name 'displays correct name
Me.GMM_Name.Requery
Dim strSQL As String
strSQL = "SELECT tbl_T133M_GMM_DIV_SDV.DIVISION FROM tbl_T133M_GMM_DIV_SDV WHERE (((tbl_T133M_GMM_DIV_SDV.GMM_NAME)=[Forms]![form_New_PSSA_Tracker_Request]![GMM_Name])) GROUP BY tbl_T133M_GMM_DIV_SDV.DIVISION;
"
Me.Division_Name.RowSource = strSQL
Me.Division_Name.Requery
Me.Division_Name.SetFocus 'this is not even setting focus
End Sub
Appreciate any assistance!
I have 2 forms, one is an update form and the other is an identical form copied from the 1st form used to add new records. There are 2 forms due to less fields and security. The update form works fine but the new form does not. There is a combobox (Division_Name) whose RowSource depends on the value selected in another combobox (GMM_Name). In both forms the RowSource for (Division_Name) is as displayed below but on the new form the "enter parameter" dialog displays for the GMM_Name:
SELECT tbl_T133M_GMM_DIV_SDV.DIVISION FROM tbl_T133M_GMM_DIV_SDV WHERE
(((tbl_T133M_GMM_DIV_SDV.GMM_NAME)=[Forms]![form_New_PSSA_Tracker_Request]![GMM_Name])) GROUP BY tbl_T133M_GMM_DIV_SDV.DIVISION;
I tried Me!GMM_Name and Me.GMM_Name, I also saved the form first, I also tried inline SQL to set the RowSource. Below is my latest code:
Private Sub GMM_Name_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.Save acForm, "form_NEW_PSSA_Request" 'saving form in case field not saved after entered
Debug.Print "GMM_Name = "; Me.GMM_Name 'displays correct name
Me.GMM_Name.Requery
Dim strSQL As String
strSQL = "SELECT tbl_T133M_GMM_DIV_SDV.DIVISION FROM tbl_T133M_GMM_DIV_SDV WHERE (((tbl_T133M_GMM_DIV_SDV.GMM_NAME)=[Forms]![form_New_PSSA_Tracker_Request]![GMM_Name])) GROUP BY tbl_T133M_GMM_DIV_SDV.DIVISION;
"
Me.Division_Name.RowSource = strSQL
Me.Division_Name.Requery
Me.Division_Name.SetFocus 'this is not even setting focus
End Sub
Appreciate any assistance!