On Format Event Procedure

J

JohnLute

I'm trying this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.PrimaryContact.Visible = (Me.PrimaryContact = True)
Me.24HRContact.Visible = (Me.24HRContact = True)
End Sub

The debugger points to <.24> as a compile error with an expected: =

Why is this and what can I do to correct?

THANKS!!!
 
J

Jeff Boyce

John

Have you tried surround the fieldname with square brackets ([])?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
F

fredg

I'm trying this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.PrimaryContact.Visible = (Me.PrimaryContact = True)
Me.24HRContact.Visible = (Me.24HRContact = True)
End Sub

The debugger points to <.24> as a compile error with an expected: =

Why is this and what can I do to correct?

THANKS!!!

Does this work?
Me![24HRContact].Visible = (Me![24HRContact] = True)

You can shorten the code to:
Me![PrimaryContact].Visible = Me![PrimaryContact]
Me![24HRContact].Visible = Me![24HRContact]
 
M

Marshall Barton

JohnLute said:
I'm trying this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.PrimaryContact.Visible = (Me.PrimaryContact = True)
Me.24HRContact.Visible = (Me.24HRContact = True)
End Sub

The debugger points to <.24> as a compile error with an expected: =

Why is this and what can I do to correct?


Names are not supposed to start with anything other than a
letter and contain anything other than letters an digits.
If you break any of those guidelines, then you must inclose
the name in [ and ]
 
J

JohnLute

As always - thanks to everyone for the help!

--
www.Marzetti.com


fredg said:
I'm trying this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.PrimaryContact.Visible = (Me.PrimaryContact = True)
Me.24HRContact.Visible = (Me.24HRContact = True)
End Sub

The debugger points to <.24> as a compile error with an expected: =

Why is this and what can I do to correct?

THANKS!!!

Does this work?
Me![24HRContact].Visible = (Me![24HRContact] = True)

You can shorten the code to:
Me![PrimaryContact].Visible = Me![PrimaryContact]
Me![24HRContact].Visible = Me![24HRContact]
 
Top