dbTalk Databases Forums  

yes/no field problem

comp.databases.ms-access comp.databases.ms-access


Discuss yes/no field problem in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
JkingSJR
 
Posts: n/a

Default yes/no field problem - 03-09-2011 , 04:46 PM






I am using this code in my report:
Private Sub Report_Current()
If IsNull(Me.Vacated) Then
Me.Vacated.Visible = False
Me.Label15.Visible = False
Else
Me.Vacated.Visible = True
Me.Label15.Visible = True
End If
End Sub

However it doesn't work because it shows the value for the field
"vacated" the same in every record when it clearly is not the same.

John King
SJR john (AT) sawtoothrecovery (DOT) com

Reply With Quote
  #2  
Old   
Access Developer
 
Posts: n/a

Default Re: yes/no field problem - 03-09-2011 , 09:25 PM






I see nothing in the code you post that would affect the value of the
Vacated field/control, only its visibility.

The most common reason for seeing the same value for each record in a
SubForm/SubReport Control is that you do not have the record in the main
Form/Report synchronized with the records displayed in the Subform Control.

What is the relationship between the main Form/Report and the
SubForm/SubReport Control, i.e., the LinkMasterFields and LinkChildFields
properties, or are you using some other approach to synchronizing them?

What version of Access? In Access through 2003, there is no "Current" event
in Reports. Do you perhaps have a Form embedded in the SubReport Control?
(It's OK to do so, but using Form events in such an embedder Form may not
work as you expect.)

Larry Linson
Microsoft Office Access MVP

"JkingSJR" <john (AT) sawtoothrecovery (DOT) com> wrote

Quote:
I am using this code in my report:
Private Sub Report_Current()
If IsNull(Me.Vacated) Then
Me.Vacated.Visible = False
Me.Label15.Visible = False
Else
Me.Vacated.Visible = True
Me.Label15.Visible = True
End If
End Sub

However it doesn't work because it shows the value for the field
"vacated" the same in every record when it clearly is not the same.

John King
SJR john (AT) sawtoothrecovery (DOT) com

Reply With Quote
  #3  
Old   
John Spencer
 
Posts: n/a

Default Re: yes/no field problem - 03-10-2011 , 07:27 AM



The code looks good, but it is probably in the wrong place.

Assuming that Label15 and Me.Vacated are in the detail section of the report,
you would use the detail section's Format event to do this. If the control's
are in another section then use that section's format event.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Vacated.Visible = Not IsNull(Me.Vacated)
Me.Label15.Visible = Not IsNull(Me.Vacated)
End Sub

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 3/9/2011 5:46 PM, JkingSJR wrote:
Quote:
I am using this code in my report:
Private Sub Report_Current()
If IsNull(Me.Vacated) Then
Me.Vacated.Visible = False
Me.Label15.Visible = False
Else
Me.Vacated.Visible = True
Me.Label15.Visible = True
End If
End Sub

However it doesn't work because it shows the value for the field
"vacated" the same in every record when it clearly is not the same.

John King
SJR john (AT) sawtoothrecovery (DOT) com

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.