Results 1 to 9 of 9
  1. #1
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160

    how do i specify the value of a continuous form field value

    Hi I need to specify a form field value on a continuous form in a select WHERE clause to populate a listbox, I have:

    WHERE (((MempBerkPrepAdmin.ComplaintGrpID)= Forms![MainComplaintsFrm].Form![ComplaintsDetailFrm].form![CompID].value));



    Which I built using Expression Builder but it doesn't work (ie. doesn't returun any results).

    Any help appreciated.

    David

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Where is the listbox located?

    Suggest you name the subform container different from the object it holds, like ctrComplaints.

    Then if the listbox is on the main form:

    WHERE ComplaintGrpID = ctrComplaints!CompID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    First, the syntax doesn't look right if this is a subform on a form and the control you want is on the subfom. Try
    [Forms]![Main form name]![subform control name].[Form]![control name on subform]
    where subformcontrol name is the name of the control that contains the subform. It is not the subform itself. You seem to have too many of Form! and I suspect you're missing the subform control reference, but you don't identify what's what so I'm guessing.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Hi, Thanks for reply's.
    Sorry didn't give all the story.
    The subform container where the listbox is a TabControl Page - TabCtl23.Page24 - and the form in question is a continuous form.

    So what I want to get to is:

    MainComplaintsFrm (Single Form) > TabCtl23 > Page24 > ComplaintsDetailFrm (continuous form) > CompID.Value

  5. #5
    Join Date
    Apr 2017
    Posts
    1,681
    Tab's and tab Page's don't affect how you reference to controls. I.e. the syntax doesn't depend from, are you referring to main form control from subform on this main form, or from subform on some page of tab control in main form. And same for referring to subform from main form.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    As Arvil said, the Tab control is irrelevant.

    If listbox is directly on page of tab control, then consider it as just on the main form and suggestion in post 2 should work.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    I tried:

    Forms![MainComplaintsFrm].Form![ComplaintsDetailFrm].Form![CompID]

    Which doesn't return anything - I dragged the form ComplaintsDetailFrm directly onto the TabControl Page so I don't have a subform container, do I need to first open a subform control and drag the continuous form onto that?

    Thanks
    David

  8. #8
    Join Date
    Apr 2017
    Posts
    1,681
    Subform is added automatically whenever you drag a form into another one. To test it:
    Activate main form in edit mode (click at left upper corner of main form) and activate form properties. In Properties window, you see properties for main form;
    Click ONCE on left upper corner of what you think to be second form - at top of properties is said, that subform is activated. When you look at source property, you see that the second form is the source for subform;
    Click again on left upper corner of subform - now you can see properties of your inserted form.

    By default the subform container gets same name as the form it contains. To avoid confusion, rename the subform container.

  9. #9
    mdavid is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    160
    Hi Arvi,
    Thanks for your detailed explanation, much appreciated.
    I did as you suggested and created a new control reference, but it still didn't produce any results, so I put a textbox on the form with the control reference as the control source and the value appeared in the textbox, so the reference is ok and I've marked this thread as solved. I will continue looking elsewhere for the problem.

    Thank you all for your help
    I'm learning alot - my problem is remembering it!

    David

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

Similar Threads

  1. Replies: 6
    Last Post: 05-21-2017, 01:12 PM
  2. HELP! Set Focus to Continuous Sub Form Field
    By asmith78 in forum Programming
    Replies: 1
    Last Post: 09-09-2011, 02:27 PM
  3. Replies: 12
    Last Post: 06-10-2011, 10:19 PM
  4. Calculated Field in continuous form
    By doobybug in forum Forms
    Replies: 2
    Last Post: 11-15-2009, 08:54 AM
  5. Replies: 2
    Last Post: 05-22-2009, 01:07 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