Run-time error '2101' (1 Viewer)

TedSla

New member
Local time
Today, 09:31
Joined
Nov 9, 2018
Messages
16
This message - Run-time error '2101'... - is raised when double clicking a field on a form, to open another form.

Full message:

Run-time error '2102'
The form name '[Product Transactions View Subform]' is misspelled or refers to a form that doesn't exist.


The form exists, opens as a Display form and opens when clicked directly, and is spelled correctly.

Same process is used with two other forms in the same app w/o the message being raised.

Here's the code behind the double click:

DoCmd.OpenForm "[Product Transactions View Subform]", acNormal, , "[ProductID=" & Me.[ProductID]

Looking at the code when the message is raised, Me.[ProductID] contains the selected valve.

I've deleted the initial form and created a new form and tried various form property settings.

And I've imported all objects into a new container as well as scoured the threads, implementing some of the suggestions to no avail.

Access 2016.

What am I missing?
 
Last edited:
And that error is what? What is the text description?
 
Code:
DoCmd.OpenForm "[Product Transactions View Subform]", acNormal, , "[ProductID=" & Me.[ProductID]

First off, i see 3 left brackets and 2 right brackets.

Then from there, my guess is you don't need brackets around the form name, unless that form name actually has brackets. Of course, I'm not entirely certain that's correct because I avoid spaces in object and field names like the plague so I can avoid this whole bracket/no bracket issue.

Those spaces in your form name are the real culprit.
 
Gotta ask, Why does the form have subform in it's name?
 
And that error is what? What is the text description?
Modified the statement to the following:

DoCmd.OpenForm "[Product Transactions View Subform]", acNormal, , "ProductID=" & Me.ProductID

The error message in Post #1 is raised.

Removed the brackets ( [ ] ) to this statement:

DoCmd.OpenForm "Product Transactions View Subform", acNormal, , "ProductID=" & Me.ProductID

And that raised a different message:

First, an Enter Parameter Value message box comes up with a 'W' showing above the field where one can enter a value.

Clicking OK w/o a valve in the field returns the following message:

Run-time error '3701':
The expression is typed incorrectly or is too complex to be evaluated. For example, a numeric expression may contain too many colplicaed elements. Try simplifying the expression by assigning parts of the expression to variables.
 
Code:
DoCmd.OpenForm "[Product Transactions View Subform]", acNormal, , "[ProductID=" & Me.[ProductID]

First off, i see 3 left brackets and 2 right brackets.

Then from there, my guess is you don't need brackets around the form name, unless that form name actually has brackets. Of course, I'm not entirely certain that's correct because I avoid spaces in object and field names like the plague so I can avoid this whole bracket/no bracket issue.

Those spaces in your form name are the real culprit.

Appreciate you finding the missing bracket.
 
What happens when you directly open "Product Transactions View Subform" by double clicking on it? Do you get the error message that way? If so your VBA is good, but your form's datasource is bad.
 
What happens when you directly open "Product Transactions View Subform" by double clicking on it? Do you get the error message that way? If so your VBA is good, but your form's datasource is bad.

Form opens correctly when clicked directly and 1) displays all of the data or, 2) if there is a request for a parameter, just the requested record.
 
I don't understand how there are 2 unique situations when you double click the form. Under what circumstances does #1 happen? #2?
 
#1 is when there isn't a parameter request for the query. All of the records display.

#2 is when there is a prompt in the query for a unique criterion (valve) raised after clicking the form. When a valid value is entered the unique record will display in the form.
 
Code:
DoCmd.OpenForm "[Product Transactions View Subform]", acNormal, , "[ProductID=" & Me.[ProductID]

First off, i see 3 left brackets and 2 right brackets.

Then from there, my guess is you don't need brackets around the form name, unless that form name actually has brackets. Of course, I'm not entirely certain that's correct because I avoid spaces in object and field names like the plague so I can avoid this whole bracket/no bracket issue.

Those spaces in your form name are the real culprit.
Renamed the form w/o spaces.

New error message:

Run-time error '3463':

Data type mismatch in criteria expression.

The ProductID is a text field.

The field on both forms are Plain Text.
 
I'm through for the day; this has consumed a lot of time and I'll look at again in the morning.

Appreciate the time and thought all have offered.

Thank you!
 
I still don't understand how clicking on the form name can produce 2 different results.
 
I still don't understand how clicking on the form name can produce 2 different results.

#1 has the query set at no parameters so all of the records are displayed.

#2 raises a small form requesting data input and any records with a matching valve are returned.
 
This message - Run-time error '2101'... - is raised when double clicking a field on a form, to open another form.

Full message:

Run-time error '2102'
The form name '[Product Transactions View Subform]' is misspelled or refers to a form that doesn't exist.


The form exists, opens as a Display form and opens when clicked directly, and is spelled correctly.

Same process is used with two other forms in the same app w/o the message being raised.

Here's the code behind the double click:

DoCmd.OpenForm "[Product Transactions View Subform]", acNormal, , "[ProductID=" & Me.[ProductID]

Looking at the code when the message is raised, Me.[ProductID] contains the selected valve.

I've deleted the initial form and created a new form and tried various form property settings.

And I've imported all objects into a new container as well as scoured the threads, implementing some of the suggestions to no avail.

Access 2016.

What am I missing?
DoCmd.OpenForm "Product Transactions View Subform", acNormal, , "[ProductID]=" & Me.ProductID &"
 
In post #11 you said ProductID is a text field so use
Code:
DoCmd.OpenForm "Product Transactions View Subform", , , "ProductID='" & Me.ProductID & "'"
acNormal is the default and can be omitted
 
In post #11 you said ProductID is a text field so use
Code:
DoCmd.OpenForm "Product Transactions View Subform", , , "ProductID='" & Me.ProductID & "'"
acNormal is the default and can be omitted
That fixed the problem.

Thank you; much appreciated.
 

Users who are viewing this thread

Back
Top Bottom