Results 1 to 12 of 12
  1. #1
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94

    Open form to a specific record from a query

    Hi - I am attempting to provide a list of records via sub-form and query - with the ability to click on one record, and open another form filtered to the record selected.



    I am using the OpenForm in a macro associated with an action, and the OpenForm Parameters are as follows:

    Form Name: frm_FTSO
    Filter Name:
    Where Condition= : = "[TaskSR=" & Nz([TaskSR],0)
    Data Mode: Edit
    Window Mode: Dialog

    The same settings on another form/query pair work fine. the problem with this one is that when the action is taken, I get an Enter Parameter Value message box requesting that I enter the search criteria for the value contained in the [TaskSR] field referenced above.

    If I enter the proper data in the message box, the new form is open to the record being requested.

    How do I fix or what do I look for to pass the value of [TaskSR] for the record I selected, to the where condition so that the parameter value box does not appear?

    Thanks...

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    You are missing a bracket:

    Where Condition= : = "[TaskSR]=" & Nz([TaskSR],0)

    And I'm not sure you really need the equals sign before it:

    Where Condition: "[TaskSR]=" & Nz([TaskSR],0)
    Last edited by boblarson; 10-05-2011 at 03:52 PM. Reason: put bracket on wrong side of the equals sign

  3. #3
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    I still get the EPV popup. Now instead of the data contained in [TaskSR], the EPV states "TaskSR=*

  4. #4
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    Oh - of note, the same syntax that I originally posted works on another form/query set. I've looked through the Db looking for a difference and it's all looks good from my end.

  5. #5
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    OK - I removed the = sign and now it passes the TaskSR. I've encountered another problem, where the form reports the filter is on, but it is not.

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by chris.williams View Post
    OK - I removed the = sign and now it passes the TaskSR. I've encountered another problem, where the form reports the filter is on, but it is not.
    Did you fix the rest of it too? The missing bracket was supposed to be there in the correct spot (and originally I put it in the wrong place).

  7. #7
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    I am using this : "[TaskSR]=" & Nz([TaskSR],0)

    It opens the form to the proper SR, but all records are navigable with the filter on.

  8. #8
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Not sure what would be causing that but there are a few form properties in 2010 that are different from my 2003 stuff I have here at work. I have 2010 at home but I'm not able to get to it at the moment.

    I would try using VBA instead of the macro -


    DoCmd.OpenForm "frm_FTSO", acNormal, DataMode:=acFormEdit, WhereCondition:="[TaskSR]=" & Nz(Me![TaskSR],0), WindowMode:=acDialog

  9. #9
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    This didn't work either. I'd be interested in knowing how to verify if a selection is being passed through to a where statement - it seems that is a possible place to look.

  10. #10
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Well, using VBA you can just put this in the event which the open form command is on:

    Debug.Print Me![TaskSR]

    to see what the value is in the Immediate Window.

  11. #11
    chris.williams is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    94
    Hi - thank you for all of your help, your quick response is unparalleled.

    Through your suggestions and continued digging, I resolved the problem by creating a temp var based on Nz and created a query which filtered on the temp var.

    I then used OpenForm with the query specified in the Filter field.

    Again, thank you for your quick responses and helpful suggestions.

  12. #12
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Glad you came up with a solution.

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

Similar Threads

  1. Replies: 4
    Last Post: 04-20-2013, 10:12 AM
  2. Open Specific Record
    By halfaguava in forum Forms
    Replies: 1
    Last Post: 06-09-2011, 04:08 PM
  3. Open Form to Specific Record
    By batowl in forum Forms
    Replies: 1
    Last Post: 04-08-2011, 10:10 AM
  4. Replies: 1
    Last Post: 04-11-2010, 04:05 AM
  5. Replies: 3
    Last Post: 01-14-2010, 08:32 AM

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