Results 1 to 7 of 7
  1. #1
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165

    Subforms Asking for Parameters and Not Loading

    I have a main form with 2 subforms, call them A and B. subform B's master field is linked to a textbox on the main form, that text box's control source is the ID field of subform A. I want subform B to display the details of the row selected on subform A.



    Subform B has a couple combo boxes that have rowsources with criteria that reference a field of the main form.

    When I was building this form everything was working smoothly and as I expected it to. I ran a compact and repair and now it's broken. When I load the main form it asks for a series of parameters, and finally displays an error. What's going on? how might I fix this?

    Click image for larger version. 

Name:	pic1.jpg 
Views:	210 
Size:	155.1 KB 
ID:	32935

    Click image for larger version. 

Name:	pic2.png 
Views:	198 
Size:	4.2 KB 
ID:	32936
    Click image for larger version. 

Name:	pic3.png 
Views:	200 
Size:	4.3 KB 
ID:	32937
    Click image for larger version. 

Name:	pic4.png 
Views:	205 
Size:	4.1 KB 
ID:	32938
    Click image for larger version. 

Name:	pic6.png 
Views:	217 
Size:	11.7 KB 
ID:	32940

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you get parameter boxes by:
    either a field is misspelled,
    or
    it does not exist in the query
    or
    the path to the text box is not correct. Use the BUILDER to the form object paths correct.


    Instead of using Dlookup, use a combo box and subform.
    user picks the Item in the combo (ID, or name)
    the subform is linked to the combo and fills in automatically. No Dlookup needed.

  3. #3
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    The paths are correct. And I always use the builder to set them. They were working fine until the compact and repair.

    The only dlookup is the one in the top left corner of the form and it's irrelevant, I've deleted it and still errors.

  4. #4
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    Okay, I think maybe this is an Access bug? I opened the VBA editor, closed it, and now all is working again... I've made no changes to this form..?????

    Any insights? If I'm doing something wrong I don't want this crap to pop up when the db is in actual use.

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    The fact that it's working may be temporary. Suggest you close down, reopen and test a few times. Sometimes, data is held and reopening the form works (like from open to design back to open views) and compiling will clear the data from memory as far as I know. The return without gosub and parameter prompt for JobHome.jID are usually caused by the same fact - that a subform loads before the parent form, and that isn't a bug. So when controls or code on a subform attempt to resolve references on the main form (which isn't open at the time) you'll get one or both of those messages. Usually the gosub message is caused by this fact, plus having code in an event that also attempts to resolve a control reference on a subform (such as the Current event). As for the other prompts, probably the same reason, but I can't tell from your pics where those fields are.
    Last edited by Micron; 03-08-2018 at 12:23 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    I'm trying to work out the sequence of events in my head...
    The rowsource of the subform's combo box is dependent on the current record in the parent form. So given that a subform loads before a parent form, then how about I keep the rowsource of subform's comboboxes blank and set property pragmatically from the parent form's ... OnCurrent event? or load event?

    [EDIT]
    And another thought: Can a combobox's rowsource query reference a field on it's OWN form without error or if it must reference a form should it be a DIFFERENT form that is guaranteed to always be loaded before its own form?

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    That would be the approach I'd take unless maybe the fields on the parent form and subform are bound, in which case, can the subform combo not make use of the linking child property and the parent form field be the master? If not, then yes, in a main form event have the subform requery itself. If you use the load event, it will only fire once. If you use the Current event, then it will fire each time the form opens as well as when you navigate to another record on the main form or requery/refresh the main form. You would have to decide on which is appropriate for your situation and know how to reference a subform from a main form. Here is one syntax for it provided a nav form isn't in play here
    Forms("frmMyForm").Controls("subformcontrolname"). Form.Requery

    Note that subformcontrolname is the name of the control on the main form that contains the subform.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Loading A Form
    By Robert2150 in forum Access
    Replies: 5
    Last Post: 06-24-2015, 01:38 PM
  2. Forms Not Loading
    By MFS in forum Access
    Replies: 3
    Last Post: 03-27-2014, 09:52 AM
  3. Loading Query
    By data808 in forum Queries
    Replies: 7
    Last Post: 01-19-2014, 12:24 AM
  4. Subforms Inside Subforms
    By LordPanzer in forum Access
    Replies: 1
    Last Post: 10-11-2013, 05:19 PM
  5. Loading and using DLL
    By mujaqo in forum Programming
    Replies: 1
    Last Post: 09-02-2013, 10:40 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