Results 1 to 3 of 3
  1. #1
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181

    Open form with conditions by double-clicking list box, Error "Object Required"


    I have a form with a list box. The form is frmFamily and the list box is ChildList. The first column in ChildList is ChildID. I would like to double-click the list box and open frmChild, and take the ChildID from ChildList and enter it into ChildID on frmChild.

    So far this is the code I've tried

    Code:
    DoCmd.OpenForm"frmChild",,,"[ChildID] = " & Me.ChildList.Column(0).Value
    DoCmd.OpenForm"frmChild",,,"[ChildID] = '" & Me.ChildList.Column(0).Value & "'"
    DoCmd.OpenForm FormName:="frmChild", WhereCondition:="[ChildID] = '" & Me.ChildList.Column(0).Value & "'"
    All come back with an error "Object required." What am I missing?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You're trying to use the WHERE condition (which filters the form's records) to set the value of a control on another form. You would have to open the form (perhaps hidden), then from 1st form, set the value, then make 2nd form visible. Or you can use the OpenArgs parameter when you open the 2nd form. In the opened form, you use the OpenArgs value that you passed to make the control on that form be what you passed.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    kagoodwin13 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Feb 2012
    Posts
    181
    The error went away by removing .Value, but the frmChild was not receiving the Value.

    Instead I entered some arguments on frmChild On Load:
    Code:
    Me.ChildID = Forms!frmFamily!ChildList.Column(0)
    That worked. Thread marked as solved.

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

Similar Threads

  1. Option Box - Error "Object Required"
    By schulzy175 in forum Programming
    Replies: 6
    Last Post: 03-19-2018, 03:42 PM
  2. Need help to resolve - Error appears "Object Required"
    By awaiskazmi in forum Programming
    Replies: 4
    Last Post: 10-30-2017, 10:45 PM
  3. Replies: 3
    Last Post: 07-12-2017, 04:29 PM
  4. Replies: 4
    Last Post: 02-12-2015, 11:42 AM
  5. Replies: 3
    Last Post: 02-06-2015, 03:22 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