A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Name? error in the group footer



 
 
Thread Tools Display Modes
  #1  
Old March 29th, 2005, 01:45 AM
SCONE
external usenet poster
 
Posts: n/a
Default #Name? error in the group footer

This is a duplicate of the subject I posted this morning about Conversion
from Access 97 to Access 2003. I'm reposting because the subject may have
been misleading.
----------------------------------------------------------------------------------------
I converted an Access 97 database to Access 2003. When I view one of the
reports, a Text Box in the group footer now displays #Name?.

The Text Box Control Source contains =[strTopPowerRating].
strTopPowerRating is a variable declared in a module that is stored with the
report. It gets reset in GroupHeader1_Format and is calculated in
Detail_Format.

-----------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Public strTopPowerRating As String
-----------------------------------------------------------------------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Expr1000 = "TopPowerRating" Then
strTopPowerRating = "X"
End If
End Sub
----------------------------------------------------------------------------------
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
strTopPowerRating = " "
End Sub
----------------------------------------------------------------------------------

I've run the debugger and watched the value in strTopPowerRating. It is
calculated properly in Detail_Format and keeps it's value until being reset
to a blank in GroupHeader1_Format. For some reason, the Text Box is not
able to pull in the value of strTopPowerRating in my Access 2003 database.

Any suggestions would be greatly appreciated.
--
Thanks,
SCONE
  #2  
Old March 29th, 2005, 05:26 AM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Variables in VBA code are not available directly to textboxes and other
controls on a report or form. When you type
=[strTopPowerRating]
in a control source for a textbox, you're telling ACCESS to get the value
from the field or control named strTopPowerRating -- and of course, because
there is no such control or field in the report, you get the #Name? error.

You could go the long way around and write a public function that will get
the value of the variable and return it as the function's value, and then
use the function in the control source expression:
=MyPublicFunctionToGetValueOfstrTopPowerRating()

But why not just use the Format event code to write the value into the
textbox:

Private Sub GroupFooternName_Format(Cancel As Integer, FormatCount As
Integer)
If Expr1000 = "TopPowerRating" Then
strTopPowerRating = "X"
End If
Me.TextBoxNameInFooter.Value = strTopPowerRating
End Sub

--

Ken Snell
MS ACCESS MVP




"SCONE" wrote in message
news
This is a duplicate of the subject I posted this morning about Conversion
from Access 97 to Access 2003. I'm reposting because the subject may have
been misleading.
----------------------------------------------------------------------------------------
I converted an Access 97 database to Access 2003. When I view one of the
reports, a Text Box in the group footer now displays #Name?.

The Text Box Control Source contains =[strTopPowerRating].
strTopPowerRating is a variable declared in a module that is stored with
the
report. It gets reset in GroupHeader1_Format and is calculated in
Detail_Format.

-----------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Public strTopPowerRating As String
-----------------------------------------------------------------------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Expr1000 = "TopPowerRating" Then
strTopPowerRating = "X"
End If
End Sub
----------------------------------------------------------------------------------
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
strTopPowerRating = " "
End Sub
----------------------------------------------------------------------------------

I've run the debugger and watched the value in strTopPowerRating. It is
calculated properly in Detail_Format and keeps it's value until being
reset
to a blank in GroupHeader1_Format. For some reason, the Text Box is not
able to pull in the value of strTopPowerRating in my Access 2003 database.

Any suggestions would be greatly appreciated.
--
Thanks,
SCONE



  #3  
Old March 29th, 2005, 04:21 PM
SCONE
external usenet poster
 
Posts: n/a
Default

Suggestion 2 was perfect. Thanks for the explanation and recommendations.

"Ken Snell [MVP]" wrote:

Variables in VBA code are not available directly to textboxes and other
controls on a report or form. When you type
=[strTopPowerRating]
in a control source for a textbox, you're telling ACCESS to get the value
from the field or control named strTopPowerRating -- and of course, because
there is no such control or field in the report, you get the #Name? error.

You could go the long way around and write a public function that will get
the value of the variable and return it as the function's value, and then
use the function in the control source expression:
=MyPublicFunctionToGetValueOfstrTopPowerRating()

But why not just use the Format event code to write the value into the
textbox:

Private Sub GroupFooternName_Format(Cancel As Integer, FormatCount As
Integer)
If Expr1000 = "TopPowerRating" Then
strTopPowerRating = "X"
End If
Me.TextBoxNameInFooter.Value = strTopPowerRating
End Sub

--

Ken Snell
MS ACCESS MVP




"SCONE" wrote in message
news
This is a duplicate of the subject I posted this morning about Conversion
from Access 97 to Access 2003. I'm reposting because the subject may have
been misleading.
----------------------------------------------------------------------------------------
I converted an Access 97 database to Access 2003. When I view one of the
reports, a Text Box in the group footer now displays #Name?.

The Text Box Control Source contains =[strTopPowerRating].
strTopPowerRating is a variable declared in a module that is stored with
the
report. It gets reset in GroupHeader1_Format and is calculated in
Detail_Format.

-----------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Public strTopPowerRating As String
-----------------------------------------------------------------------------------
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Expr1000 = "TopPowerRating" Then
strTopPowerRating = "X"
End If
End Sub
----------------------------------------------------------------------------------
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
strTopPowerRating = " "
End Sub
----------------------------------------------------------------------------------

I've run the debugger and watched the value in strTopPowerRating. It is
calculated properly in Detail_Format and keeps it's value until being
reset
to a blank in GroupHeader1_Format. For some reason, the Text Box is not
able to pull in the value of strTopPowerRating in my Access 2003 database.

Any suggestions would be greatly appreciated.
--
Thanks,
SCONE




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Group Footer in Set Location Vandy Setting Up & Running Reports 1 February 2nd, 2005 10:53 PM
Hide group footer based on field value Paul Kraemer Setting Up & Running Reports 1 January 31st, 2005 09:13 PM
Hide group footer based on field value Paul Kraemer via AccessMonster.com Setting Up & Running Reports 0 January 31st, 2005 07:04 PM
Using DCount in Group Footer filtering records based on value of the group Beth Setting Up & Running Reports 1 September 10th, 2004 04:17 PM
how divide detail by group footer total Dan Setting Up & Running Reports 3 May 25th, 2004 07:28 PM


All times are GMT +1. The time now is 03:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.