SetValue AllowAdditions

  • Thread starter Thread starter Darren Sawyer via AccessMonster.com
  • Start date Start date
D

Darren Sawyer via AccessMonster.com

Hi

I'm trying to set the allowadditons property of a form using a macro and
setvalue. However, this returns an error message:

"The object you referenced in the Visual Basic Procedure as an OLE object
isn't an OLE object."

Having seen this on a similar thread for people try to setvalue Visible I
tried a similar tact to the MS bug fix but now I get the error message:

"Type Mismatch" when I run the module.

I've tried different vaules e.g. False, No, -1 but to no avail.

Help! AM I missing something, just being stupid, or none of the above?
 
Post the expressions that you tried to use and that gave the errors. And
provide some explanation of the context for when the macro is being run,
from which form, from which event, etc.
 
Darren,

Can't answer your question, because you didn't say what you have done.

However, this should work for you...

Action: SetValue
Item: [Form].[AllowAdditions]
Expression: No
 
Thanks folks your help will be appreciated.

I am trying to set up a macro that, subject to conditions, when going from
frmMenu disables AllowAdditions in frmRecords before then opening frmRecords.
I've tested the conditions and they work fine but...

When trying SetValue Macro:

Action: SetValue
Item: Forms![frmRecords].AllowAdditions
Expression: False

Result: "The object you referenced in the Visual Basic Procedure as an OLE
object isn't an OLE object."

When trying using RunCode Macro:

Action: RunCode
Function Name: SetAllowAdditions (Forms!frmRecords, No )

also tried false and -1 but then get "Type Mismatch"

Module:SetAllowAdditions

Public Function SetAllowAdditions(frmTarget As Object, fValue As Boolean)

frmTarget.AllowAdditions = fValue

End Function
 
You cannot set the AllowAdditions property of frmRecords until after you've
opened it. The error message that you're getting is telling you that the
form is not open, therefore you cannot reference any of its properties.
 
Thanks Ken

I was just beginning to consider that might be the case and you've confirmed
it for me.

Just need a slight rejig on my plan and I'm there.

Best regards

Darren
 
Back
Top