SetValue AllowAdditions

  • Thread starter Darren Sawyer via AccessMonster.com
  • 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?
 
K

Ken Snell [MVP]

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.
 
S

Steve Schapel

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
 
D

Darren via AccessMonster.com

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
 
K

Ken Snell [MVP]

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.
 
D

Darren via AccessMonster.com

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top