Enter Parameter Value Error On Form With Only Subforms

EnginerdUNH
StarLounger
Posts: 94
Joined: 14 Aug 2019, 00:12

Enter Parameter Value Error On Form With Only Subforms

Post by EnginerdUNH »

Hi,

I am working on building an administrative controls form for the database that I've been building. The form itself has no record source and is just an empty form consisting of four subforms. The issue that I've been running into is that when I go to open the form, Access gives me an "Enter Parameter Value" error that only started occurring when I added the two most recent subforms. I do not get the error when I go to load the subform separately from the main form. Any ideas on what could be causing this?

EileenStifone
NewLounger
Posts: 15
Joined: 16 Aug 2022, 05:39

Re: Enter Parameter Value Error On Form With Only Subforms

Post by EileenStifone »

You must check in the queries set as Record Source of the offending subforms that there is no reference to a control, which acts as a filter, but cannot be found in any of the open forms.

User avatar
Gasman
2StarLounger
Posts: 119
Joined: 22 Feb 2022, 09:04

Re: Enter Parameter Value Error On Form With Only Subforms

Post by Gasman »

And what parameter value is it asking for?
That would be a clue?

Subforms load before mainforms.
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

EnginerdUNH
StarLounger
Posts: 94
Joined: 14 Aug 2019, 00:12

Re: Enter Parameter Value Error On Form With Only Subforms

Post by EnginerdUNH »

Hi EileenStifone, I did confirm that the queries for the record sources on the offending subforms are only referencing fields on that form. Also, if that was the issue, wouldn't I also be having this issue when trying to load the subforms on their own, separate from the main form? As stated in the OP, doing that works fine, it's just when I try to load them as a subform.

Hi Gasman, on both of the subforms, it's the fields it's asking for parameter for are an autonumber and a number. Also, I did read something somewhere I think about subforms loading before the main form. Do you know if there's a way to delay loading of the subform to see if that resolves my issue?

User avatar
Gasman
2StarLounger
Posts: 119
Joined: 22 Feb 2022, 09:04

Re: Enter Parameter Value Error On Form With Only Subforms

Post by Gasman »

You can set the subform control sourceobject in the main form load?

Alternatively, upload the db with instructions on how to recreate.
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.

EnginerdUNH
StarLounger
Posts: 94
Joined: 14 Aug 2019, 00:12

Re: Enter Parameter Value Error On Form With Only Subforms

Post by EnginerdUNH »

Gasman wrote:
05 May 2024, 12:46
You can set the subform control sourceobject in the main form load?

Alternatively, upload the db with instructions on how to recreate.
Ok I've tried the following with no success:
1. Removing the source object from the subform properties in design view and setting it on the on load event of the main form
2. Opening the subform to a new record on the on load event of the subform

Neither step, separate or together, worked to resolve the issue

EileenStifone
NewLounger
Posts: 15
Joined: 16 Aug 2022, 05:39

Re: Enter Parameter Value Error On Form With Only Subforms

Post by EileenStifone »

If you can post the file.

User avatar
HansV
Administrator
Posts: 78631
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Enter Parameter Value Error On Form With Only Subforms

Post by HansV »

Let's say the name of the subform in the navigation pane is MySubForm.
Do you refer to Forms!MySubForm!... in the record source of the form, or in the control source or row source of any of the controls on MySubForm?
That will work if you open MySubForm by itself, but not when you open the main form that contains MySubForm, because in that situation MySubForm is not part of the Forms collection. You'd have to use Forms!MainFormName!MySubForm!...
Best wishes,
Hans

EnginerdUNH
StarLounger
Posts: 94
Joined: 14 Aug 2019, 00:12

Re: Enter Parameter Value Error On Form With Only Subforms

Post by EnginerdUNH »

HansV wrote:
06 May 2024, 09:55
Let's say the name of the subform in the navigation pane is MySubForm.
Do you refer to Forms!MySubForm!... in the record source of the form, or in the control source or row source of any of the controls on MySubForm?
That will work if you open MySubForm by itself, but not when you open the main form that contains MySubForm, because in that situation MySubForm is not part of the Forms collection. You'd have to use Forms!MainFormName!MySubForm!...
Hi Hans, I went into the query behind the record source and sure enough there was a Forms!MySubForm!... reference in both of the offending queries. I changed the references to Forms!MainFormName!MySubForm!... and now they work! Thanks so much!! Definitely not something I would have thought about.

User avatar
Gasman
2StarLounger
Posts: 119
Joined: 22 Feb 2022, 09:04

Re: Enter Parameter Value Error On Form With Only Subforms

Post by Gasman »

Now they will not work if you open the subform on its own.

I used to use tempvars if I needed the form in both modes for any reason.
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.