Refresh Query

EVP

Registered User.
Local time
Today, 20:21
Joined
Oct 10, 2003
Messages
27
Hello,
I couldn't find help on the forms forum, so I thought I'd try here.

I have a form for a query with a parameter value. I'm having problems 'refreshing' this query, meaning once a value is entered as a parameter, I can't get the parameter box to appear again (unless I close out the form, which I don't want the user to do).

Any ideas?
Thanks
 
How is the Parameter passed to the query, via a combo box, textbox etc? If so then Me.Requery in the AfterUpdate event of the control will do it.
 
Thank you,
It is a combo box.
I apologize for being a self-taught (but not very well) Access user that gets roped into being a programmer;
But where would this event control be?
Are you speaking of the form, or the query?
I would most like to link this event to a command button.

Thank you for your help and patience:p
 
Okay,
I did find the AfterUpdate control, but this code did not work. I think the problem is I am not actually closing the form, but using a command button to open another form. This is how I want the front end to appear, not sure how much work this requires on the back end.

Thank you for any thoughts you may have!
 
Where is the combo box that has the parameter? Once the form with the query is loaded, can you still see the combo box? Not sure what you are trying to accomplish.

If you put the requery command on the the after update event of the combo box. Be aware the requery has to reference the form that contains the query.

Forms!YourFormName.Requery

Hope this helps
 
The combo box is in the form, and yes it is visible.

I tried this code in the AfterUpdate of the combo box. Still doesn't work.
I'm trying this from a new angle, Do you know where can I put:

DoCmd.Close

In this command button:

Private Sub HURtrntoMainCmd6_Click()
On Error GoTo Err_HURtrntoMainCmd6_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "HUMainFrm"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_HURtrntoMainCmd6_Click:
Exit Sub

Err_HURtrntoMainCmd6_Click:
MsgBox Err.Description
Resume Exit_HURtrntoMainCmd6_Click

End Sub

To close the form: HUStatusFrm, while activating the event above?
This is essentially what I'm trying to do, otherwise the form remains open and it won't requery. The user will have to click back to the main form, then click back to this form to run the query.?? That's the best I can come up with given my skills.

Thanks for any help.
 
__________________________
Private Sub HURtrntoMainCmd6_Click()
On Error GoTo Err_HURtrntoMainCmd6_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "HUMainFrm"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_HURtrntoMainCmd6_Click:
DoCmd.Close <-------------------PUT IT HERE
Exit Sub

Err_HURtrntoMainCmd6_Click:
MsgBox Err.Description
Resume Exit_HURtrntoMainCmd6_Click

End Sub
________________________________

Do this is if you want to close the current form, after opening the new one from the command button.

You shouldn't need to close it though. Where is code for your requery?

Also where is the parameter for the query?
 

Users who are viewing this thread

Back
Top Bottom