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. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Visible or Invisible Code
Try this:
If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#12
|
|||
|
|||
Visible or Invisible Code
Still didn't work, it is visible even if Text355 is greater than 30.
Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#13
|
|||
|
|||
Visible or Invisible Code
What is the format of Text355 control? Is it a text-formatted control? Or a
numeric-formatted control? You said that it's unbound, and has an expression for the control source. I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? You don't mean to test Text355 and set the visible property of Text355? Did you try putting a breakpoint on the code so that it stops on the If .. then statement? When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 Which control (not field) has this as its control source? I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#14
|
|||
|
|||
Visible or Invisible Code
SEE BELOW: FOR YOUR REPLY:
"Ken Snell" wrote in message ... What is the format of Text355 control? (FORMAT NOT SET) (ALTHOUGH IT WILL BE A NUMBER) Is it a text-formatted control? Or a numeric-formatted control? You said that it's unbound, and has an expression for the control source. (YES =[FTimeBillingSub].[Form]![Text21] IS ITS CONTROL SOURCE ) I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? (YES) You don't mean to test Text355 and set the visible property of Text355? (NO) Did you try putting a breakpoint on the code so that it stops on the If .. then statement? (YES) When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? (THE NUMBER IN IT SAYS -30 instead of 30 ) Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 (TEXT335 CONTROL SOURCE IS [Bid]*0.02 ) Which control (not field) has this as its control source? (TEXT335) I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#15
|
|||
|
|||
Visible or Invisible Code
You said that you did put a breakpoint on the code so that it stops on the
If ..then statement. When it does stop on that line, put cursor over the Text355 word and see what value it has ... is it the value that you expect? This is important for troubleshooting. Based on the fact that the value can be negative, this may be better for your code: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If Also, just in case Text355 is coming as a text string (don't know why it should, but just in case): If Val(Text355) 0 And Abs(Val(Text355)) 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message . com... SEE BELOW: FOR YOUR REPLY: "Ken Snell" wrote in message ... What is the format of Text355 control? (FORMAT NOT SET) (ALTHOUGH IT WILL BE A NUMBER) Is it a text-formatted control? Or a numeric-formatted control? You said that it's unbound, and has an expression for the control source. (YES =[FTimeBillingSub].[Form]![Text21] IS ITS CONTROL SOURCE ) I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? (YES) You don't mean to test Text355 and set the visible property of Text355? (NO) Did you try putting a breakpoint on the code so that it stops on the If ... then statement? (YES) When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? (THE NUMBER IN IT SAYS -30 instead of 30 ) Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 (TEXT335 CONTROL SOURCE IS [Bid]*0.02 ) Which control (not field) has this as its control source? (TEXT335) I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#16
|
|||
|
|||
Visible or Invisible Code
Ok, Ken, 0 to 30 days code works, just not next code: (Text338) & 9Text340)
If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If "Ken Snell" wrote in message ... You said that you did put a breakpoint on the code so that it stops on the If ..then statement. When it does stop on that line, put cursor over the Text355 word and see what value it has ... is it the value that you expect? This is important for troubleshooting. Based on the fact that the value can be negative, this may be better for your code: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If Also, just in case Text355 is coming as a text string (don't know why it should, but just in case): If Val(Text355) 0 And Abs(Val(Text355)) 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message . com... SEE BELOW: FOR YOUR REPLY: "Ken Snell" wrote in message ... What is the format of Text355 control? (FORMAT NOT SET) (ALTHOUGH IT WILL BE A NUMBER) Is it a text-formatted control? Or a numeric-formatted control? You said that it's unbound, and has an expression for the control source. (YES =[FTimeBillingSub].[Form]![Text21] IS ITS CONTROL SOURCE ) I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? (YES) You don't mean to test Text355 and set the visible property of Text355? (NO) Did you try putting a breakpoint on the code so that it stops on the If .. then statement? (YES) When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? (THE NUMBER IN IT SAYS -30 instead of 30 ) Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 (TEXT335 CONTROL SOURCE IS [Bid]*0.02 ) Which control (not field) has this as its control source? (TEXT335) I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#17
|
|||
|
|||
Visible or Invisible Code
Assuming that the "negative" value possibility applies to all:
If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If However, let me suggest a tidier code to use instead of the above: Dim lngValue As Long lngValue = Abs(Text355) Text335.Visible = (lngValue 31 And lngValue 0) Text338.Visible = (lngValue 30 And lngValue 61) Text340.Visible = (lngValue 60 And lngValue 180) -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Ok, Ken, 0 to 30 days code works, just not next code: (Text338) & 9Text340) If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If "Ken Snell" wrote in message ... You said that you did put a breakpoint on the code so that it stops on the If ..then statement. When it does stop on that line, put cursor over the Text355 word and see what value it has ... is it the value that you expect? This is important for troubleshooting. Based on the fact that the value can be negative, this may be better for your code: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If Also, just in case Text355 is coming as a text string (don't know why it should, but just in case): If Val(Text355) 0 And Abs(Val(Text355)) 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message . com... SEE BELOW: FOR YOUR REPLY: "Ken Snell" wrote in message ... What is the format of Text355 control? (FORMAT NOT SET) (ALTHOUGH IT WILL BE A NUMBER) Is it a text-formatted control? Or a numeric-formatted control? You said that it's unbound, and has an expression for the control source. (YES =[FTimeBillingSub].[Form]![Text21] IS ITS CONTROL SOURCE ) I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? (YES) You don't mean to test Text355 and set the visible property of Text355? (NO) Did you try putting a breakpoint on the code so that it stops on the If .. then statement? (YES) When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? (THE NUMBER IN IT SAYS -30 instead of 30 ) Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 (TEXT335 CONTROL SOURCE IS [Bid]*0.02 ) Which control (not field) has this as its control source? (TEXT335) I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#18
|
|||
|
|||
Visible or Invisible Code
Hip, Hip, Hooray,, Thanks, that works really well. Thanks for your help and
patience. Dave "Ken Snell" wrote in message ... Assuming that the "negative" value possibility applies to all: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If However, let me suggest a tidier code to use instead of the above: Dim lngValue As Long lngValue = Abs(Text355) Text335.Visible = (lngValue 31 And lngValue 0) Text338.Visible = (lngValue 30 And lngValue 61) Text340.Visible = (lngValue 60 And lngValue 180) -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Ok, Ken, 0 to 30 days code works, just not next code: (Text338) & 9Text340) If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If "Ken Snell" wrote in message ... You said that you did put a breakpoint on the code so that it stops on the If ..then statement. When it does stop on that line, put cursor over the Text355 word and see what value it has ... is it the value that you expect? This is important for troubleshooting. Based on the fact that the value can be negative, this may be better for your code: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If Also, just in case Text355 is coming as a text string (don't know why it should, but just in case): If Val(Text355) 0 And Abs(Val(Text355)) 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message . com... SEE BELOW: FOR YOUR REPLY: "Ken Snell" wrote in message ... What is the format of Text355 control? (FORMAT NOT SET) (ALTHOUGH IT WILL BE A NUMBER) Is it a text-formatted control? Or a numeric-formatted control? You said that it's unbound, and has an expression for the control source. (YES =[FTimeBillingSub].[Form]![Text21] IS ITS CONTROL SOURCE ) I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? (YES) You don't mean to test Text355 and set the visible property of Text355? (NO) Did you try putting a breakpoint on the code so that it stops on the If .. then statement? (YES) When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? (THE NUMBER IN IT SAYS -30 instead of 30 ) Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 (TEXT335 CONTROL SOURCE IS [Bid]*0.02 ) Which control (not field) has this as its control source? (TEXT335) I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
#19
|
|||
|
|||
Visible or Invisible Code
You're welcome.
-- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Hip, Hip, Hooray,, Thanks, that works really well. Thanks for your help and patience. Dave "Ken Snell" wrote in message ... Assuming that the "negative" value possibility applies to all: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If However, let me suggest a tidier code to use instead of the above: Dim lngValue As Long lngValue = Abs(Text355) Text335.Visible = (lngValue 31 And lngValue 0) Text338.Visible = (lngValue 30 And lngValue 61) Text340.Visible = (lngValue 60 And lngValue 180) -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Ok, Ken, 0 to 30 days code works, just not next code: (Text338) & 9Text340) If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If If Text355 30 And Abs(Text355) 61 Then Text338.Visible = True Else Text338.Visible = False End If If Text355 60 And Abs(Text355) 180 Then Text340.Visible = True Else Text340.Visible = False End If "Ken Snell" wrote in message ... You said that you did put a breakpoint on the code so that it stops on the If ..then statement. When it does stop on that line, put cursor over the Text355 word and see what value it has ... is it the value that you expect? This is important for troubleshooting. Based on the fact that the value can be negative, this may be better for your code: If Text355 0 And Abs(Text355) 31 Then Text335.Visible = True Else Text335.Visible = False End If Also, just in case Text355 is coming as a text string (don't know why it should, but just in case): If Val(Text355) 0 And Abs(Val(Text355)) 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message . com... SEE BELOW: FOR YOUR REPLY: "Ken Snell" wrote in message ... What is the format of Text355 control? (FORMAT NOT SET) (ALTHOUGH IT WILL BE A NUMBER) Is it a text-formatted control? Or a numeric-formatted control? You said that it's unbound, and has an expression for the control source. (YES =[FTimeBillingSub].[Form]![Text21] IS ITS CONTROL SOURCE ) I note that you're testing the value of Text355 in order to set the visible property of Text335? Is this correct? (YES) You don't mean to test Text355 and set the visible property of Text355? (NO) Did you try putting a breakpoint on the code so that it stops on the If .. then statement? (YES) When it does, put cursor over the Text355 word and see what value it has ... is it the value that you expect? I'm not sure what you mean by the other post where you say Text355 is (can be?) a negative number? (THE NUMBER IN IT SAYS -30 instead of 30 ) Are you saying that the test for zero should look at it being not exactly zero instead of greater than zero? Or did you mean that you want to see if Text355 is less than 31 and Text335 is not equal to zero? You earlier said that the value of *the* "field" is =[BidA]*0.02 (TEXT335 CONTROL SOURCE IS [Bid]*0.02 ) Which control (not field) has this as its control source? (TEXT335) I'm afraid that my confusion is growing and I need some clarification, please. Thanks. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Still didn't work, it is visible even if Text355 is greater than 30. Should default value of Text335 be set to visible or not, does this make a difference? Under it's properties I mean. "Ken Snell" wrote in message ... Try this: If Text355 0 And Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message om... Ok, got it kinda. the problem is that Text335 equals a value and it still show a value even if it is $0.00 Is there a way to make it be invisible even if the value is 0 as well as If Text355 31 Then Text335.Visible = True Else Text335.Visible = False End If Below is the Value of the field, it is a calculated field. =[BidA]*0.02 "Dave Elliott" wrote in message ... Tried that, didn't work "Ken Snell" wrote in message ... Try putting the code on the OnCurrent event of the main form. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Text335 value is currency if this makes a difference Also I tried putting a Text Box on the main form TimeCards named Text355 which value is linked to Text box on sub-from FTimeBillingSub Text Box 21 Then I put this code on the before update event for the main form TimeCards and it still did not work. If Nz(Me.Text355) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If "Ken Snell" wrote in message ... I'm guessing that the code is not running when you think it's supposed to be running. Try putting a breakpoint on the If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then line and see if the code actually runs when you expect it to. Likely you'll need to put this code on a different event, but I am not sure which one to recommend yet based on what you've posted. I am not sure which "value" is changing and therefore what should trigger the code to run. -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message m... Basically the field on the sub-form (FTimeBillingSub) which is linked to the main form frmAutoPayrollReport requeries itself after a value changes. The field Tex21 which is unbound shows how many days have passed since the Invoice was made. It is a number field. Then the field on the form frmAutoPayrollReport Text335 should be visible if the value of Text21 is less than 31, otherwise it should be invisible. "Ken Snell" wrote in message ... Not sure what you want to happen. This code is run when the OnCurrent event of the main form occurs? Does the subform "move" with the change in main form's record? It's possible that the subform's control does not have a "new" value yet when the main form record changes (assuming that the subform is linked to the main form), though the use of Nz function should ensure a zero value being returned if a Null is encountered. The subform control may still have the previous record's value. Have you stepped through the code to be sure that the value of Me.FTimeBillingSub.Form!Text21 is what you expect it to be? -- Ken Snell MS ACCESS MVP "Dave Elliott" wrote in message ... This code should make a (NUMBER) field visible or invisible but does not, why? The number field is Text21, it is a sub-form on a main form named frmAutoPayrollReport. The code below is on current from form frmAutoPayrollReport If Nz(Me.FTimeBillingSub.Form!Text21) 31 Then Me.Text335.Visible = True Else Me.Text335.Visible = False End If |
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Form to generate a Report code | Pat Coleman | Setting Up & Running Reports | 4 | July 16th, 2004 12:58 PM |
Conversion of excel vba code to access vba | filnigeria | General Discussion | 5 | July 15th, 2004 02:23 AM |
Hide or show Control Button on Form in Access 97 | Pete Sperling | Using Forms | 8 | July 13th, 2004 04:13 PM |
Expression - calculating running total | Kathy | Running & Setting Up Queries | 26 | June 22nd, 2004 10:14 PM |