UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Setting Subform Recordsource Gives Error 459, Access 2016    
 
   
MrSiezen
post Nov 27 2017, 05:20 AM
Post#1



Posts: 2,380
Joined: 15-February 05
From: Den Bosch - Netherlands


Hi all!

I have some short code to prepare my development FE database for distribution.

It runs through the (sub)forms to delete recordsource SQL's when I don't want the form to have a recordsource when first opened.
Many times when working on the form's design, it saves it WITH the on the fly generated recordsource.
Very annoing, so I have made some code the fix these before distribution.

CODE
DoCmd.OpenForm "frmIKD_seasoninfo", acDesign, , , , acHidden
Forms!frmIKD_seasoninfo.RecordSource = ""
DoCmd.Close acForm, "frmIKD_seasoninfo", acSaveYes

DoCmd.OpenForm "frmIKD_shipments", acDesign, , , , acHidden
Forms!frmIKD_shipments.RecordSource = ""
DoCmd.Close acForm, "frmIKD_shipments", acSaveYes

etc...


But when end users open forms with a subform that was stripped from it's recordsource, it generates this error when I try to set the form's recordsource. Not all, though, and it seems random which form fails.

CODE
Me.subfrmSeasoninfo.Form.RecordSource = "SELECT component_seasoninfo.* .etc...."

This lines error in:
"Run-time error '459': Object or Class does not support the set of events"

I compact and repair before distribution...

--------------------
UA Rulez!
Go to the top of the page
 
RuralGuy
post Nov 27 2017, 07:16 AM
Post#2


UtterAccess VIP
Posts: 2,798
Joined: 25-June 05
From: @ 8300' in the Colorado Rocky Mountains


Does your SubFormControl have the same name as the SubForm it displays?

--------------------
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please reply to the forum so all may benefit.
Go to the top of the page
 
MrSiezen
post Nov 27 2017, 07:47 AM
Post#3



Posts: 2,380
Joined: 15-February 05
From: Den Bosch - Netherlands


No
subformcontrol name <-> form name
subfrmSeasoninfo <-> frmIKD_seasoninfo

--------------------
UA Rulez!
Go to the top of the page
 
RuralGuy
post Nov 27 2017, 07:56 AM
Post#4


UtterAccess VIP
Posts: 2,798
Joined: 25-June 05
From: @ 8300' in the Colorado Rocky Mountains


Random is bothersome. I would *import* everything to a fresh new db and see if the problem follows.

--------------------
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please reply to the forum so all may benefit.
Go to the top of the page
 
BruceM
post Nov 27 2017, 08:40 AM
Post#5


UtterAccess VIP
Posts: 7,022
Joined: 24-May 10
From: Downeast Maine


QUOTE
I don't want the form to have a recordsource when first opened

Why not just set it to "" at that time, then?

I agree with Allan that if the error is truly random, importing into a new database is a good place to start.
Go to the top of the page
 
MrSiezen
post Dec 4 2017, 07:53 AM
Post#6



Posts: 2,380
Joined: 15-February 05
From: Den Bosch - Netherlands


Hi guys,

It's been a while, but I've found a fix. As it seems it wasn't that random, it occurred with one subform only... (really thought it were other subforms as well, but ok...)

Anyway, I just changed the main form's control name of the subform control to something else, and that fixed it.
IMHO, a bug...

--------------------
UA Rulez!
Go to the top of the page
 
RuralGuy
post Dec 4 2017, 08:05 AM
Post#7


UtterAccess VIP
Posts: 2,798
Joined: 25-June 05
From: @ 8300' in the Colorado Rocky Mountains


Thanks for the update.

--------------------
(RG for short) aka Allan Bunch Previous MS Access MVP acXP, ac07, ac10, ac13 - WinXP Pro, Win7 Pro, Win10 Pro
Please reply to the forum so all may benefit.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 04:52 AM