![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Me.lblAM.Visible = Not (IsNull(Me.txtAM)) Me.lblPM.Visible = Not (IsNull(Me.txtPM)) |
#3
| |||
| |||
|
|
It would help if you included all the code and also told us what the problem is. *Do you get a syntax error? The label controls are always visible? *The label controls are never visible? Perhaps you are executing the code in the wrong section of the report? *Are you executing the code in the section where the labels are located (as a guess, the detail section)? Is it possible that txtAM and txtPM are zero-length strings? *You can handle zero-length strings, nulls, and strings that have multiple spaces using expressions like the following: Me.lblAM.Visible = Len(Trim(me.txtAM & "")) > 0 Me.lblPM.Visible = Len(Trim(me.txtPM & "")) > 0 John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County On 6/20/2011 9:46 AM, flymo wrote: Me.lblAM.Visible = Not (IsNull(Me.txtAM)) Me.lblPM.Visible = Not (IsNull(Me.txtPM)) |
#4
| |||
| |||
|
|
It would help if you included all the code and also told us what the problem is. *Do you get a syntax error? The label controls are always visible? *The label controls are never visible? Perhaps you are executing the code in the wrong section of the report? *Are you executing the code in the section where the labels are located (as a guess, the detail section)? Is it possible that txtAM and txtPM are zero-length strings? *You can handle zero-length strings, nulls, and strings that have multiple spaces using expressions like the following: Me.lblAM.Visible = Len(Trim(me.txtAM & "")) > 0 Me.lblPM.Visible = Len(Trim(me.txtPM & "")) > 0 John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County On 6/20/2011 9:46 AM, flymo wrote: Me.lblAM.Visible = Not (IsNull(Me.txtAM)) Me.lblPM.Visible = Not (IsNull(Me.txtPM)) |
#5
| |||
| |||
|
|
I set the crosstab up to show ___________AM__PM name date___X___X |
|
It would help if you included all the code and also told us what the problem is. Do you get a syntax error? The label controls are always visible? The label controls are never visible? Perhaps you are executing the code in the wrong section of the report? Are you executing the code in the section where the labels are located (as a guess, the detail section)? Is it possible that txtAM and txtPM are zero-length strings? You can handle zero-length strings, nulls, and strings that have multiple spaces using expressions like the following: Me.lblAM.Visible = Len(Trim(me.txtAM & "")) > 0 Me.lblPM.Visible = Len(Trim(me.txtPM & "")) > 0 John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County On 6/20/2011 9:46 AM, flymo wrote: Me.lblAM.Visible = Not (IsNull(Me.txtAM)) Me.lblPM.Visible = Not (IsNull(Me.txtPM)) |
#6
| |||
| |||
|
|
I'm not certain what you mean by *> I set the crosstab up to show *> *___________AM__PM *> name date___X___X If the crosstab is, in fact, returning the values you show in the lines following "I set the crosstab up to show" when the time is not available or the other information is not available, the field is neither a zero-length string nor is it null, and the textbox displaying it will not be, so neither your IF nor John's would be applicable. *I agree with him that you needto show the details. -- *Larry Linson, Microsoft Office Access MVP *Co-author: "Microsoft Access Small Business Solutions", published by Wiley *Access newsgroup support is alive and well in USENET comp.databases.ms-access "flymo" <fly... (AT) hotmail (DOT) com> wrote in message news:dc26ab9e-e17a-496d-b0bc-68d1ba497e5c (AT) d14g2000yqb (DOT) googlegroups.com... On Jun 20, 10:55 am, John Spencer <JSPEN... (AT) Hilltop (DOT) umbc> wrote: It would help if you included all the code and also told us what the problem is. Do you get a syntax error? The label controls are always visible? The label controls are never visible? Perhaps you are executing the code in the wrong section of the report? Are you executing the code in the section where the labels are located (as a guess, the detail section)? Is it possible that txtAM and txtPM are zero-length strings? You can handle zero-length strings, nulls, and strings that have multiple spaces using expressions like the following: Me.lblAM.Visible = Len(Trim(me.txtAM & "")) > 0 Me.lblPM.Visible = Len(Trim(me.txtPM & "")) > 0 John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County On 6/20/2011 9:46 AM, flymo wrote: Me.lblAM.Visible = Not (IsNull(Me.txtAM)) Me.lblPM.Visible = Not (IsNull(Me.txtPM)) Hello John Yes I am using the detail section of the report and I have tried the format & print events. The labels are always visible regardless of what ever code I attach to the events I also tried your attached lines without success. I recreated another report in case the initial one was corrupted in some way, unfortunately I get the same result. I set the crosstab up to show ___________AM__PM name date___X___X I am trying to place the lblAM over txtAM if txtAM is not null the label shows and covers the txtbox, if the txtAM is null then the txt and label are hidden. Hope this clarifies Regards John |
#7
| |||
| |||
|
|
The query has the fields Row - Name, Date Column - session (can be AM,PM or EVE) Count Value - Name The crosstab actually shows in the report: _____________AM__PM (this is the page header) Name |Date | 1 | 1 | Name |Date | 1 | | Name |Date | 1 | 1 | Name |Date | 1 | 1 | Name |Date | |1 | What I want to show is: Name |Date | AM | PM | Name |Date | AM | | Name |Date | AM | PM | Name |Date | AM | PM | Name |Date | | PM | When I try to apply null or "" or if txtAM >0 or txtAM = 1 the labels appear regardless of any condition set. I think you should replace the query generated by the crosstab query wizard |
#8
| |||
| |||
|
|
flymo wrote: The query has the fields Row - *Name, Date Column - session (can be AM,PM or EVE) Count Value - Name The crosstab actually shows in the report: _____________AM__PM *(this is the page header) Name |Date | 1 | 1 | Name |Date | 1 | * | Name |Date | 1 | 1 | Name |Date | 1 | 1 | Name |Date | * *|1 | What I want to show is: Name |Date | AM | PM | Name |Date | AM | * *| Name |Date | AM | PM | Name |Date | AM | PM | Name |Date | * *| PM | When I try to apply null or "" or if txtAM >0 *or txtAM = 1 the labels appear regardless of any condition set. I think you should replace the query generated by the crosstab query wizard with something like this: Select [name], [date] , iif(SUM(iif([session]='AM',1,0))>0,'AM','') AM , iif(SUM(iif([session]='PM',1,0))>0,'PM','') PM , iif(SUM(iif([session]='EVE',1,0))>0,'EVE','') EVE FROM yourtable GROUP BY [name], [date] Alternatively, you could base a new query on the saved crosstab and do the similar IIF logic: Select [name], [date] , iif([AM]>0,'AM','') AM etc FROM your_saved_crosstab_query |
#9
| |||
| |||
|
|
I'm not certain what you mean by I set the crosstab up to show ___________AM__PM name date___X___X If the crosstab is, in fact, returning the values you show in the lines following "I set the crosstab up to show" when the time is not available or the other information is not available, the field is neither a zero-length string nor is it null, and the textbox displaying it will not be, so neither your IF nor John's would be applicable. I agree with him that you need to show the details. -- Larry Linson, Microsoft Office Access MVP Co-author: "Microsoft Access Small Business Solutions", published by Wiley Access newsgroup support is alive and well in USENET comp.databases.ms-access "flymo" <fly... (AT) hotmail (DOT) com> wrote in message news:dc26ab9e-e17a-496d-b0bc-68d1ba497e5c (AT) d14g2000yqb (DOT) googlegroups.com... On Jun 20, 10:55 am, John Spencer <JSPEN... (AT) Hilltop (DOT) umbc> wrote: It would help if you included all the code and also told us what the problem is. Do you get a syntax error? The label controls are always visible? The label controls are never visible? Perhaps you are executing the code in the wrong section of the report? Are you executing the code in the section where the labels are located (as a guess, the detail section)? Is it possible that txtAM and txtPM are zero-length strings? You can handle zero-length strings, nulls, and strings that have multiple spaces using expressions like the following: Me.lblAM.Visible = Len(Trim(me.txtAM & "")) > 0 Me.lblPM.Visible = Len(Trim(me.txtPM & "")) > 0 John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County On 6/20/2011 9:46 AM, flymo wrote: Me.lblAM.Visible = Not (IsNull(Me.txtAM)) Me.lblPM.Visible = Not (IsNull(Me.txtPM)) Hello John Yes I am using the detail section of the report and I have tried the format & print events. The labels are always visible regardless of what ever code I attach to the events I also tried your attached lines without success. I recreated another report in case the initial one was corrupted in some way, unfortunately I get the same result. I set the crosstab up to show ___________AM__PM name date___X___X I am trying to place the lblAM over txtAM if txtAM is not null the label shows and covers the txtbox, if the txtAM is null then the txt and label are hidden. Hope this clarifies Regards John |
#10
| |||
| |||
|
|
On Jun 20, 2:56*pm, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote: flymo wrote: The query has the fields Row - *Name, Date Column - session (can be AM,PM or EVE) Count Value - Name The crosstab actually shows in the report: _____________AM__PM *(this is the page header) Name |Date | 1 | 1 | Name |Date | 1 | * | Name |Date | 1 | 1 | Name |Date | 1 | 1 | Name |Date | * *|1 | What I want to show is: Name |Date | AM | PM | Name |Date | AM | * *| Name |Date | AM | PM | Name |Date | AM | PM | Name |Date | * *| PM | When I try to apply null or "" or if txtAM >0 *or txtAM = 1 the labels appear regardless of any condition set. I think you should replace the query generated by the crosstab query wizard with something like this: Select [name], [date] , iif(SUM(iif([session]='AM',1,0))>0,'AM','') AM , iif(SUM(iif([session]='PM',1,0))>0,'PM','') PM , iif(SUM(iif([session]='EVE',1,0))>0,'EVE','') EVE FROM yourtable GROUP BY [name], [date] Alternatively, you could base a new query on the saved crosstab and do the similar IIF logic: Select [name], [date] , iif([AM]>0,'AM','') AM etc FROM your_saved_crosstab_query Thanks Bob I will try that, Much appreciated John Hello Bob, |
![]() |
| Thread Tools | |
| Display Modes | |
| |