Results 1 to 4 of 4
  1. #1
    AKQTS is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    56

    Refresh Query using Value on Form?

    I have a parameter query where it asks the user for an order number which then displays the parts on that order on the form.



    Due to a new feature, I would like to refresh that query without having to reenter the query parmeter.

    Can I refresh a parameter query using a previously entered value as the parameter value?

    This query is the record source for a form so I was not wanting to change this, but pass a value into the parameter required to run the query.

  2. #2
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    One of the easier ways is to have the user enter the values in a form field instead of using a pop-up parameter.
    • Use the current function to open a small launcher form asking for the parameter which also launches the desired order form.
    • Edit the query to get the parameter from the launcher form field.
    • The launcher form with the stored parameter can be left open with the parameter so each time the query runs it can pull the value from the form

    You might also be able to do it using a pop-up parameter:
    • Setup a query which initially populates the form via a pop-up parameter.
    • Pass the value to a hidden field on the form.
    • Create a similar query to read that hidden value as the parameter
    • In whatever event would refresh the query, change the record source for the form to the other query.
    • Use Me.Requery to refresh the data
    I have used the 1st method many times before. I haven't tried the 2nd method but it seems like it could work.

  3. #3
    AKQTS is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jul 2010
    Posts
    56
    I am trying your second method above. The query alone works great, but my code keeps freezing up the program.

    DoCmd.Echo False, ""
    DoCmd.SetWarnings False
    Forms!Reject_Record.RecordSource = "Reject_record_Query_Refresh"
    DoCmd.OpenQuery "Reject_record_Query_Refresh", acViewNormal, acEdit
    Forms!Reject_Record.Refresh

  4. #4
    slave138's Avatar
    slave138 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    WI
    Posts
    233
    You have a number of commands which don't seem to relate to what you are trying to do (unless there is more which you haven't elaborated).

    The first two lines should not be necessary, nor should the 4th unless you are trying to open a seperate query on top of everything else.

    I would use a Me.Requery (or Forms!Reject_Record.Requery) instead of Refresh.

    Comment out the 1st, 2nd, & 4th lines in your code (and switch to Requery) and see if performance improves. If it does, uncomment each line until you find the source of the delay.

    Also, you should remember to turn the Warnings back on after performing your actions.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-04-2010, 01:31 PM
  2. update/refresh form
    By SlowPoke in forum Access
    Replies: 3
    Last Post: 09-20-2010, 09:21 AM
  3. refresh a form
    By RedGoneWILD in forum Forms
    Replies: 18
    Last Post: 09-03-2010, 08:31 AM
  4. Update/ Refresh Query
    By Vikki in forum Queries
    Replies: 0
    Last Post: 03-23-2010, 06:59 AM
  5. Refresh form search text box
    By oxicottin in forum Forms
    Replies: 2
    Last Post: 11-19-2007, 02:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums