Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 09-20-2016, 12:43 PM   #1
MilaK
Newly Registered User
 
Join Date: Feb 2015
Location: United States
Posts: 282
Thanks: 33
Thanked 2 Times in 2 Posts
MilaK is on a distinguished road
Application defined or object defined error '2465'

Hello,

I'm trying to filter a 'single form' sub-form when the main form opens. I need the sub-form to show a participial record that is dictated by the filter criteria. The Main form opens but I get an error message and filter fails. Note: both sample_id (primary key) and run_name are strings.

Here is the vba code I'm using:

Code:
strform = "frm_combined_CNVs"

Criteria = "[sample_id] = '" & empty_sample1 & "' AND [run_name] = '" & Me.txt_Run_Name.Value & "'"
Debug.Print Criteria

DoCmd.OpenForm strform

Application.Echo False
        Forms!frm_combined_CNVs.frm_sample_cnv1.Form.Filter = Criteria
        Forms!frm_combined_CNVs.frm_sample_cnv1.Form.FilterOn = True
Application.Echo True
Is the filter failing because I'm trying to filter a Single Form? Thanks, Mila

MilaK is offline   Reply With Quote
Old 09-20-2016, 05:07 PM   #2
sneuberg
AWF VIP
 
Join Date: Oct 2014
Location: Tucson, Arizona
Posts: 3,506
Thanks: 362
Thanked 976 Times in 943 Posts
sneuberg will become famous soon enough sneuberg will become famous soon enough
Re: Application defined or object defined error '2465'

I just tried something very similar and it doesn't seem to make a difference where continuous or single form. If your code is in the form's load or open event I suggest creating the references like:

Code:
 Me.frm_sample_cnv1.Form.Filter = Criteria
 Me.frm_sample_cnv1.Form.FilterOn = True
So Intellisense will let you know if you are getting them right.

If this code is not in the form's load or open event then is the form and subform open when this code is run?


On what line is the error occurring?
__________________
And now nothing will be restrained from them, which they have imagined to do. Genesis 11:6

Steve
sneuberg is offline   Reply With Quote
Old 09-21-2016, 11:17 AM   #3
MilaK
Newly Registered User
 
Join Date: Feb 2015
Location: United States
Posts: 282
Thanks: 33
Thanked 2 Times in 2 Posts
MilaK is on a distinguished road
Re: Application defined or object defined error '2465'

I can get the form to open. I get an error message and the
Code:
Forms!frm_combined_CNVs.frm_sample_cnv1.Form.Filter = Criteria1
is highlighter.

I also tried this method without success: DoCmd.OpenForm
Code:
"frm_combined_CNVs", , , "Forms!frm_combined_CNVs.frm_sample_cnv1.Form.[sample_id] = '" & sample_id & "'
I'm attaching a sample database. All patient related information has been removed. "Form1" button contains the code that opens "frm_combined_CNVs" form.

Any advice/suggestions will be greatly appreciated.

Thanks for your help, Mila
Attached Files
File Type: zip Example_Db.zip (193.0 KB, 42 views)

MilaK is offline   Reply With Quote
Old 09-21-2016, 11:43 AM   #4
sneuberg
AWF VIP
 
Join Date: Oct 2014
Location: Tucson, Arizona
Posts: 3,506
Thanks: 362
Thanked 976 Times in 943 Posts
sneuberg will become famous soon enough sneuberg will become famous soon enough
Re: Application defined or object defined error '2465'

Your references weren't correct. Try

Code:
Forms![frm_combined_CNVs]![frm_sample_cnv].[Form].Filter = Criteria1
Forms![frm_combined_CNVs]![frm_sample_cnv].[Form].FilterOn = True
I think it's better if you give the subform and the form in it the same name. In this case the form was frm_sample_cnv1 but the subform was frm_sample_cnv. The subform control is what goes in the reference. This link might help you in the future.
__________________
And now nothing will be restrained from them, which they have imagined to do. Genesis 11:6

Steve
sneuberg is offline   Reply With Quote
The Following User Says Thank You to sneuberg For This Useful Post:
MilaK (09-21-2016)
Old 09-21-2016, 01:14 PM   #5
MilaK
Newly Registered User
 
Join Date: Feb 2015
Location: United States
Posts: 282
Thanks: 33
Thanked 2 Times in 2 Posts
MilaK is on a distinguished road
Re: Application defined or object defined error '2465'

Thanks, everything works now!

Quick question...

Do you think it's a bad idea to include this many subform on a single form? Do you think it might take a very long time to load when the database will get larger?

We should be upgraded on Office 2016 soon, not sure if that's important.

Thanks,

Mila
MilaK is offline   Reply With Quote
Old 09-21-2016, 02:05 PM   #6
sneuberg
AWF VIP
 
Join Date: Oct 2014
Location: Tucson, Arizona
Posts: 3,506
Thanks: 362
Thanked 976 Times in 943 Posts
sneuberg will become famous soon enough sneuberg will become famous soon enough
Re: Application defined or object defined error '2465'

Quote:
Originally Posted by MilaK View Post
Thanks, everything works now!

Quick question...

Do you think it's a bad idea to include this many subform on a single form? Do you think it might take a very long time to load when the database will get larger?

We should be upgraded on Office 2016 soon, not sure if that's important.

Thanks,

Mila
I don't know or have an opinion on either of these. I suggest you start new threads with these questions?

Glad it's working for you.

__________________
And now nothing will be restrained from them, which they have imagined to do. Genesis 11:6

Steve
sneuberg is offline   Reply With Quote
Reply

Tags
filter

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
run-time error '1004' application-defined or object-defined josros60 Excel 2 04-09-2016 04:51 AM
[SOLVED] Access 2010 write to Excel 2013, application defined or object defined error 50290 Lifeseeker Modules & VBA 1 01-06-2015 03:08 AM
[SOLVED] Tip: One possible source of "2465 Application-defined or object-defined error" mdlueck Modules & VBA 0 03-14-2013 11:37 AM
Error 2465 application defined or object defined error. pn4108 General 4 11-18-2006 02:19 AM
[SOLVED] Application-defined or object-defined error in Access 2000 Magilla General 3 06-20-2004 07:15 PM




All times are GMT -8. The time now is 07:37 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World