Solved

Command Button to run query and refresh subform isnt working:

Posted on 2008-06-23
6
1,464 Views
Last Modified: 2010-04-21
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
0
Comment
Question by:schneider_ks
  • 3
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
mrnev earned 500 total points
Comment Utility
Does the Query_update_Value_request_archive query pick up the value from  Forms!frm_Value_Request_Archive!Text24?  If it does then this will only work when form  frm_Value_Request_Archive is open, not when form  frm_Value_Request_Archive1 is open.  One way around this would be to duplicate the query under a new name (say Query_update_Value_request_archive1 and make this pick up the parameter value from Forms!frm_Value_Request_Archive1!Text24 (note the 1 in the form name) and change the VBA on the button on frm_Value_Request_Archive1 to run the new query.
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
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


0
 

Author Comment

by:schneider_ks
Comment Utility
The Source Object is the same for both forms:
SF_Value_Request_Archive
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:schneider_ks
Comment Utility
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"
0
 

Author Closing Comment

by:schneider_ks
Comment Utility
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!  
0
 
LVL 4

Expert Comment

by:mrnev
Comment Utility
<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.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now