Visible or Invisible Question

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

Thanks,

Dave
 
I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
It gave me a #Name? error , dont know why!
What can I do to correct this?

Jim Allensworth said:
I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

It gave me a #Name? error , dont know why!
What can I do to correct this?

Jim Allensworth said:
I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
And/or if you are doing some
procedure that might affect the value of Text21, put it there also.
Er, the procedure not the textbox. We don't need no more #Name?'s.
 
OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says >30

Jim Allensworth said:
Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

It gave me a #Name? error , dont know why!
What can I do to correct this?

Jim Allensworth said:
On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Dave,
Copy and post the code that you are using.
When you say "criteria" do you mean the value of Text21?

- Jim

OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says >30

Jim Allensworth said:
Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

It gave me a #Name? error , dont know why!
What can I do to correct this?

On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound
text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Jim, here is the code:
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30 < 60




Jim Allensworth said:
Dave,
Copy and post the code that you are using.
When you say "criteria" do you mean the value of Text21?

- Jim

OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says >30

Jim Allensworth said:
Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

On Wed, 21 Jul 2004 18:31:56 GMT, "Dave Elliott"

It gave me a #Name? error , dont know why!
What can I do to correct this?

On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound
text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if
Text21
on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Dave,
Remove the "< 60" at the end - I don't know where that came from.
It should be...
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30

A little about this equation:
The control property (Visible) on the left side of the equation can be
set to either True or False. The expression on the right side will
evaluate to either True or False. You can set a break in code at this
point to evaluate the expression and values.

- Jim

Jim, here is the code:
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30 < 60




Jim Allensworth said:
Dave,
Copy and post the code that you are using.
When you say "criteria" do you mean the value of Text21?

- Jim

OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says >30

Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

On Wed, 21 Jul 2004 18:31:56 GMT, "Dave Elliott"

It gave me a #Name? error , dont know why!
What can I do to correct this?

On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound
text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21
on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Jim it just makes it invisible all the time.

Jim Allensworth said:
Dave,
Remove the "< 60" at the end - I don't know where that came from.
It should be...
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30

A little about this equation:
The control property (Visible) on the left side of the equation can be
set to either True or False. The expression on the right side will
evaluate to either True or False. You can set a break in code at this
point to evaluate the expression and values.

- Jim

Jim, here is the code:
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30 < 60




Jim Allensworth said:
Dave,
Copy and post the code that you are using.
When you say "criteria" do you mean the value of Text21?

- Jim

On Wed, 21 Jul 2004 18:58:49 GMT, "Dave Elliott"

OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says >30

Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

On Wed, 21 Jul 2004 18:31:56 GMT, "Dave Elliott"

It gave me a #Name? error , dont know why!
What can I do to correct this?

On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound
text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21
on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Tried this code also, It still stays visible not matter what? Set Text335
Property to NOT Visible.
P.S. There is also other code that runs on current procedure.

If Nz(Me.FTimeBillingSub.Form!Text21) < 30 Then
Me.Text335.Visible = True
End If
 
Jim, if it is OK, could send DB with just the main form zipped. Have to open
in design mode...
 
Dave something else is affecting the controls property. Did you try
setting a break in code and following it through the steps?

Also, post the entire procedure.

- Jim

Jim it just makes it invisible all the time.

Jim Allensworth said:
Dave,
Remove the "< 60" at the end - I don't know where that came from.
It should be...
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30

A little about this equation:
The control property (Visible) on the left side of the equation can be
set to either True or False. The expression on the right side will
evaluate to either True or False. You can set a break in code at this
point to evaluate the expression and values.

- Jim

Jim, here is the code:
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30 < 60




Dave,
Copy and post the code that you are using.
When you say "criteria" do you mean the value of Text21?

- Jim

On Wed, 21 Jul 2004 18:58:49 GMT, "Dave Elliott"

OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says >30

Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

On Wed, 21 Jul 2004 18:31:56 GMT, "Dave Elliott"

It gave me a #Name? error , dont know why!
What can I do to correct this?

On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a
unbound
text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if
Text21
on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Dave, lets keep this online. Why not just post the procedure -
everything between header and End Sub...

Private Sub Form_Current()
'just copy and paste it all.
End Sub


- Jim

Jim, if it is OK, could send DB with just the main form zipped. Have to open
in design mode...

Dave Elliott said:
I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

Thanks,

Dave
 
Ok, here is all the code:
Private Sub Form_Current()
Call EnableCtl
If DSum("Payment", "TPaymentSub", "TimeID=Forms!TimeCards!TimeID") >
Me.BidDiscAmt Then
End If

If Nz(Me.FTimeBillingSub.Form!Text21) < 30 Then
Me.Text335.Visible = True
End If
End Sub


Jim Allensworth said:
Dave something else is affecting the controls property. Did you try
setting a break in code and following it through the steps?

Also, post the entire procedure.

- Jim

Jim it just makes it invisible all the time.

Jim Allensworth said:
Dave,
Remove the "< 60" at the end - I don't know where that came from.
It should be...
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30

A little about this equation:
The control property (Visible) on the left side of the equation can be
set to either True or False. The expression on the right side will
evaluate to either True or False. You can set a break in code at this
point to evaluate the expression and values.

- Jim

On Thu, 22 Jul 2004 12:23:37 GMT, "Dave Elliott"

Jim, here is the code:
Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30 < 60




Dave,
Copy and post the code that you are using.
When you say "criteria" do you mean the value of Text21?

- Jim

On Wed, 21 Jul 2004 18:58:49 GMT, "Dave Elliott"

OK, Put it in TimeCards form on current event code.
It stays invisible all the time now even though the criteria says 30

Where have you put the code?

It sounds like you placed it in a control - maybe the textbox. It
should go in the Form's On Current event. And/or if you are doing some
procedure that might affect the value of Text21, put it there also.

- Jim

On Wed, 21 Jul 2004 18:31:56 GMT, "Dave Elliott"

It gave me a #Name? error , dont know why!
What can I do to correct this?

On Wed, 21 Jul 2004 17:01:42 GMT, "Dave Elliott"

I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a
unbound
text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335
which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if
Text21
on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

On the main form; in its current event (probably)...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) > 30


- Jim
 
Here is the Module Code referred to in on current (EndableCtl)

Function EnableCtl() 'Error-handler inserted on 12/30/2003 at 18:38 by Dave
Elliott
On Error GoTo EnableCtl_Error 'This is use on the TimeCards form only.

If IsNull(Forms!TimeCards!TimeID) Or IsNull(Forms!TimeCards!StartDte) Then
Forms!TimeCards!FTimeBillingSub.Visible = False
Forms!TimeCards!FPaymentSub.Visible = False
Forms!TimeCards!LblPrtQuot.Visible = True
Else:
Forms!TimeCards!FTimeBillingSub.Visible = True
Forms!TimeCards!FPaymentSub.Visible = True
Forms!TimeCards!LblPrtQuot.Visible = False
End If

EnableCtl_Exit:
Exit Function
EnableCtl_Error:
MsgBox "Unexpected error - " & Err.Number & vbCrLf & vbCrLf & Error$,
vbExclamation, "WithHoldTax - EnaCtl ModDate"
Resume EnableCtl_Exit
End Function
 
Comments inline...

Ok, here is all the code:
Private Sub Form_Current()
Call EnableCtl
I don't see anything in this proc that would affect Text335
If DSum("Payment", "TPaymentSub", "TimeID=Forms!TimeCards!TimeID") >
Me.BidDiscAmt Then
End If
This of course does nothing. Maybe it's in-process for future
completion. If so then you would need to change the Criteria portion.
As is it would generate an error. Change to ...

If DSum("Payment", "TPaymentSub", _
"TimeID=" & Me.TimeID) > Me.BidDiscAmt Then
If Nz(Me.FTimeBillingSub.Form!Text21) < 30 Then
Me.Text335.Visible = True
End If
There is nothing here to set it to not visible, only to visible. If
you want to use an End If block then you need an Else to deal with the
alternative.

If Nz(Me.FTimeBillingSub.Form!Text21) < 30 Then
Me.Text335.Visible = True
Else
Me.Text335.Visible = False
End If

ALTHOUGH, this does the same thing ...

Me.Text335.Visible = Nz(Me.FTimeBillingSub.Form!Text21) >= 30

It's more concise.

- Jim
 
How 'bout this?

If Nz(Me.FTimeBillingSub.Form!Text21) < 30 Then
Me.Text335.Visible = True
Else
Me.Text335.Visible = False
End If


Dave said:
Tried this code also, It still stays visible not matter what? Set Text335
Property to NOT Visible.
P.S. There is also other code that runs on current procedure.

If Nz(Me.FTimeBillingSub.Form!Text21) < 30 Then
Me.Text335.Visible = True
End If


I have a main form named TimeCards
on it there is a sub-form named FTimeBillingSub which has a unbound text
box named Text21
that shows how many days since the Customer was Invoiced.
On the main form (TimeCards) there is also a unbound text box named
Text335

which shows 2% of the amount Invoiced.
this is the formula for it. =[BidA]*0.02
I would like this text box Text335 to be visible only if Text21 on
sub-form FTimeBillingSub on the main form TimeCards
value is greater than 30.
Can this be done?
If so how?

Thanks,

Dave
 
Back
Top