[AccessD] If-Then in a report

Kathryn Bassett kathryn at bassett.net
Fri Jun 13 21:21:16 CDT 2003


Well, shoot, I tried suggestions by Stuart, Byran, and Charlotte, and I gues I'm not getting exactly where I'm to put the code. If I'm understanding correctly, it goes in the same area as the Image5.Picture = photo. So, I tried this:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Image5.Picture = photo
If connections < " " Then
  connections.Visible = False
  Label17.Visible = False
Else
  connections.Visible = True
 Label17.Visible = True
End If
End Sub

But that didn't make any difference. Connections: still shows up with empty fields. Trying Bryan's code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Image5.Picture = photo
If connections = "" Then
  [ConnectionsLabel].Visible = False
Else
  [ConnectionsLabel].Visible = True
End If
End Sub

Gives me a debug error   [ConnectionsLabel].Visible = True

And using
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Image5.Picture = photo
Label17.Visible = Len(Me.connections & "") > 0
End Sub

won't even compile (yes, I've finally learned enough to remember that step). It's A2k if that makes a difference. I zipped it (about 1mg zipped) and it's at:
http://altadenabaptist.org/abc.zip
and the report is:
PhotoDirectory - Photos Done - Connections

I'm guessing that I'm still missing something.

Thanks,

--
Kathryn Rhinehart Bassett (Pasadena CA)
"Genealogy is my bag" "GH is my soap"
kathryn at bassett.net
http://bassett.net  


> -----Original Message-----
> From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg]
> Sent: 13 Jun 2003 4:31:AM
> To: Kathryn Bassett; accessd at databaseadvisors.com
> Subject: Re: [AccessD] If-Then in a report
> 
> 
> On 12 Jun 2003 at 23:03, Kathryn Bassett wrote:
> 
> > Thanks again to Stuart, my report is almost exactly what I want (except final 
> lining up etc):
> > http://altadenabaptist.org/images/Image2.jpg
> > 
> > Next, I want to know how to make the Connections *label* to only show up if there 
> is content in the field.
> > Going back to the image that shows the layout:
> > http://altadenabaptist.org/images/Image1.jpg
> > you can see how it's set at present. I know how to trim in the content, but not how 
> to make the label appear/disappear. My thoughts are:
> > If the field called "connections" is not blank, then print Connections followed by 
> a colon and then a space, and then the contents of the Connections field.
> > I'm guessing it is done by somehow using the trim (& not using the label), but 
> can't figure out the exact syntax.
> > I tried this:
> > =trim(Connections: & " " & [connections])
> > but it tells me I've entered an operand without an operator.
> > 
> > I need the correct syntax, and also need to know if I'm right that if the 
> connections field is empty, it will not put anything, including the Connections: or 
> is there some other solution?
> > 
> Looks like Label17 is not tied to the connections field. In that 
> case.
> 
> in your Detail_format() put:
> 
> If connections < " " then
>   connections.visible = false
>   label17.visible = false
> else
>   connections.visible = true
>  label17.visible  = true
> end if
> 
> or if connections can be null you need
> if nz(connections,"") < " " 
> 
> 
> -- 
> Lexacorp Ltd
> http://www.lexacorp.com.pg
> Information Technology Consultancy, Software Development,System 
> Support.
> 
> 
> 



More information about the AccessD mailing list