Link to home
Start Free TrialLog in
Avatar of schneider_ks
schneider_ks

asked on

Command Button to run query and refresh subform isnt working:

Command Button to run query and refresh subform isnt working:

I have two forms (they are essentially the same, just sized differently for different size computer screens):
Frm_Value_Request_Archive
Frm_Value Request_Archive1

The subform on each of these forms is the same:
SF_Value_Request_Arvhice

When I click on the RnRfrshQry command button in the second example below, I get this error message:
Enter Parameter Value: Forms!frm_Value_Request_Archive!Text24

The command button for frm_Value_Request_Archive DOES WORK:
Frm_Value_Request_Archive

Private Sub cmd_refresh_Click()
On Error GoTo Err_cmd_refresh_Click

    Dim stDocName As String

    stDocName = "qry_update_Value_Request_Archive"
    DoCmd.SetWarnings False
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    [frm_Value_Request_Archive subform].Form.Requery
DoCmd.SetWarnings True
Exit_cmd_refresh_Click:
    Exit Sub

Err_cmd_refresh_Click:
    MsgBox Err.Description
    Resume Exit_cmd_refresh_Click
   
End Sub


For this form (Value_Request_Archive1) the command button DOESNT work:

Private Sub RnRfrshQry_Click()
On Error GoTo Err_RnRfrshQry_Click

    Dim stDocName As String

    stDocName = "qry_update_Value_Request_Archive"
    DoCmd.SetWarnings False
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    [frm_Value_Request_Archive1 subform].Form.Requery
DoCmd.SetWarnings True
Exit_RnRfrshQry_Click:
    Exit Sub

Err_RnRfrshQry_Click:
    MsgBox Err.Description
    Resume Exit_RnRfrshQry_Click
   
End Sub
ASKER CERTIFIED SOLUTION
Avatar of mrnev
mrnev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rey Obrero (Capricorn1)
open Value_Request_Archive1 in design view
select the outer part of the subform
hit F4 to open the property sheet
select the Data tab
  * see what is in the Source Object
 
  copy and post  here

select the Other tab
  * see what is in the Name

  copy and post  here


Avatar of schneider_ks
schneider_ks

ASKER

The Source Object is the same for both forms:
SF_Value_Request_Archive
Sorry, I misspelled the SF in the text of my original request - it should read
"The subform on each of these forms is the same:
SF_Value_Request_Archive"
Thank you so much - I'm working with queries that I didn't design - it's pretty simple, but I didn't think of this!  
<Thank you so much - I'm working with queries that I didn't design - it's pretty simple, but I didn't think of this! >

No problem, glad I could help.