Access: CloseButton = False :: Runtime Error 2448

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

MRdNk

Thread Starter
Joined
Apr 7, 2007
Messages
439
Hi All,

Attempting to set the CloseButton property for a subform via a Module, the module is referred to via On Current:

Private Sub Form_Current()
Call basForms.SubFormsSetup(Me)​
End Sub
And the Module (basForms) is:

Sub SubFormsSetup(FormName)
FormName.CloseButton = False​
End Sub
But I just get a Run-Time error 2448, "You can't assign a value to this object".

Real confused as to why its not working.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
I think that you might need me.name in the basForms.SubFormsSetup(me.name)
I use this version to close a Form, so you should be able to adapt it to set the control.

Dim formname As String
formname = Me.name
Call Closeform(formname)

and using a Public Sub

Public Sub Closeform(formname As String)
On Error GoTo Err_cmdClose_Click

DoCmd.Close acForm, formname

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub
 

MRdNk

Thread Starter
Joined
Apr 7, 2007
Messages
439
The stupid thing is, the following does work:

Private Sub Form_Current()
Call basForms.FormsSetup(Me) '<------ WORKS​
Call basForms.SubFormsSetup(Me) '<------- Works here, but in the called modules doesn't​
End Sub
Module, for other Form Setup Options:

Sub FormsSetup(FormName)
FormName.ScrollBars = 0
FormName.RecordSelectors = False
FormName.NavigationButtons = False
FormName.DividingLines = False​
End Sub
However, it breaks on this module:

Sub SubFormsSetup(FormName)
FormName.CloseButton = False '<---- Breaks down here​
End Sub

I tried your suggestion OBP, but it still doesn't like it!
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Have you tried it for the "Control Box", that would remove the Close Button at the same time?
 

MRdNk

Thread Starter
Joined
Apr 7, 2007
Messages
439
Curiouser and curiouser! It doesn't like that either.

Now I am confused.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top