What's the name of a subform object?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a toggle box next to a subform. When the toggle is clicked, the
subform should allow deletions/additions/edits. When the toggle is clicked
again, the subform should not allow such.

I've tried the caption name for the subform but that doesn't seem to be
working. What's the name of a subform?

Edit: In the following sub
Code:
Private Sub Name_Toggle_Click()
If [Name Toggle].Value = True Then
[Name Toggle].Picture = "F:\Access\redbutton.bmp"
[Note Information Subform].NavigationButtons = False
ElseIf [Name Toggle].Value = False Then
[Name Toggle].Picture = "F:\Access\bluebutton.bmp"
[Note Information Subform].NavigationButtons = True
End If
End Sub
I've tried "[Note Information Subform]", "Forms![Note
Information Subform]", "Forms![Apprentice Information]![Note Information
Subform]", "[Note Info]" <- the record source
 
You reference a subform by the name of the Subform Control on the main form,
NOT by the name of the form it contains. Quite often this name is the same
as the actual subform it contains, but it doesn't have to be. In your code
module type: Me. then scroll down until you find the name of the control.
The Intellisense will have the name of the subform control and not the
subform. (Or you can right-click on the very edge of the subform and choose
properties. It will also tell you what the name is.)

The "general" syntax would be:

Me.subControl1.Form.NavigationButtons = False

Replace subControl1 with your actual subform control name.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Banaticus said:
I have a toggle box next to a subform. When the toggle is clicked, the
subform should allow deletions/additions/edits. When the toggle is clicked
again, the subform should not allow such.

I've tried the caption name for the subform but that doesn't seem to be
working. What's the name of a subform?

Edit: In the following sub
Code:
Private Sub Name_Toggle_Click()
If [Name Toggle].Value = True Then
[Name Toggle].Picture = "F:\Access\redbutton.bmp"
[Note Information Subform].NavigationButtons = False
ElseIf [Name Toggle].Value = False Then
[Name Toggle].Picture = "F:\Access\bluebutton.bmp"
[Note Information Subform].NavigationButtons = True
End If
End Sub
I've tried "[Note Information Subform]", "Forms![Note
Information Subform]", "Forms![Apprentice Information]![Note Information
Subform]", "[Note Info]" <- the record source


First, you have to use the name of the subform **control**,
which might be different from the name of the form object it
is displaying.

Second, you should use the form property to refer to the
form object , instead of the subform control object:

[Note Information Subform].FORM.NavigationButtons = False
 
Back
Top