Error 2467 if subform's Load event an/or error 2424 in open event

I have a subform control xDetail on a main form frmMain.
xDetail can be loaded with a variety of forms (selected according to user actions in another subform) and may also have it's recordsource adjusted to display a subset of records.
The lines of code I have to do this are:

Public Sub LoadLinkedForm(pstrFormName As String, pstrSQL As String)

2260     On Error GoTo PROC_ERR
2270     Forms.frmmain!xDetail.SourceObject = pstrFormName
2280     Forms.frmmain!xDetail.Form.RecordSource = pstrSQL
2300     Exit Sub
2310     Select Case Err.Number
             Case Else
2320             LogError
2330     End Select
2340     Resume PROC_EXIT
2350     Resume
     End Sub

Open in new window

Often, but not always, when this code is run, I get either an error 2467 in the load event of the form being loaded or an error 2424 in the current event when the sourceobject is being set. In both cases, the code is referencing a control on the form (not the same control in the two events).

When the errors happen:

frms.frmmain.xdetail.visible = true
frms.frmmain.xdetail.form.visible = true
frms.frmmain.xdetail.sourceobject = "frmSource" 'This is an examle; it happens with a variety of forms. = "frmSource"
frms.frmmain.xdetail.form.recordsource = "SELECT qrySource.* FROM qrySource WHERE qrySourceID = 39;"

If I run a query based on the recordsource, it returns a single record (as expected).

When the error 2467 occurs, if I examine "Me" in the Locals window, everything is showing "<>".
When the error 2424 occurs, "Me" in the locals window looks as I would expect, except that all of the controls have the value: The expression you entered has a field, control or property name that Access can't find.

The 2424 error also happens in the Current event sometimes when the recordsource is being changed.

The same forms can also be loaded into another subform on frmMain but I haven't *yet* seen them fail if they're loaded there?

I'm bemused as how how to proceed with this one.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
A sample DB would probably make this much easier for most experts here to understand.

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Compile the code. (From the VBA code window, click: Debug-->Compile)
10. Run the compact/Repair utility.
11. Remove any Passwords and/or security.
12. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
13. Post the explicit steps to replicate the issue.
14. Test the database before posting.

In other words, a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

colevalleygirlAuthor Commented:
OK, I've followed your guidance and the problem DB is attached. You will also need to install the 3rd party OCX attached (for which I have distribution rights) into Windows\System32 or Windows\SysWOW64. It's a reputable 3rd party OCX from SoftelVDM; I don't believe it's implicated in the problem but the application navigation depends upon it. The forms are set to Pop-up because they are opened sometimes in that state.

To replicate the 2467 problem:

In the top left pane of the mainform, Expand Repositories and Click on New Repository.
In the bottom left pane, click on Sources.

You should get an error 2467.

Correction: I'm not being allowed to upload the ocx or a zipped version of it! So this isn't going to help....
colevalleygirlAuthor Commented:
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

colevalleygirlAuthor Commented:
I shall be offline for some time now -- time differences and other commitments. I'll be back 1000 GMT.
Jeffrey CoachmanMIS LiasonCommented:

I'll look at this around 10PM New York time
colevalleygirlAuthor Commented:
Just to add a little more info, I've modified the code a little to set the recordsource at Open (passed via a global variable). It seems on first testing to have reduced the occurence of the error but not eliminated it totally.
Jeffrey CoachmanMIS LiasonCommented:

OK, I'll let you know in a few...
Jeffrey CoachmanMIS LiasonCommented:
Could not load the control
encountered errors
colevalleygirlAuthor Commented:
I'd be on very shaky ground making the developer copy of the ocx available.
I may have to continue working on this on my own.
Jeffrey CoachmanMIS LiasonCommented:

I tried...

But the error may have to do with naming.

So make sure to double check your spelling on all associated objects.

Also make sure you are using a solid naming convention and not leaving the default names...

Make sure you have all your service Packs in place for Office *And* Windows.
Finally make sure you compact and Repair the database regularly and compile the code.

colevalleygirlAuthor Commented:
Checking all the naming hasn't shown anything. I've gone back to do a complete redesign.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
colevalleygirlAuthor Commented:
The experts tried hard to help, but the database is so complex it needs a redeign.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.