Visible Code does not work?

D

Dave Elliott

If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
R

Rick Brandt

Dave Elliott said:
If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107

You might have a zero length string instead of a Null.

Try...

Text107.Visible = Len(Nz([ChkNoA],""))
 
D

Dan Artuso

Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?
 
D

Dave Elliott

Code did not work.
ChkNoA contains a number or else is blank.

Rick Brandt said:
Dave Elliott said:
If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107

You might have a zero length string instead of a Null.

Try...

Text107.Visible = Len(Nz([ChkNoA],""))
 
D

Dave Elliott

The Visible part does not work.

Dan Artuso said:
Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dan Artuso

Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become visible.
If you haven't stepped through it, do so to verify that your IsNull check is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


Dave Elliott said:
The Visible part does not work.

Dan Artuso said:
Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dave Elliott

I have on this form a comand button that prints the check and the code below
works for it.
So when the form opens or after a update or upon printing the check, then
the visible code needs to work.

If Not IsNull([ChkNoID]) Then
Text107.Visible = True
End If




Dan Artuso said:
Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become visible.
If you haven't stepped through it, do so to verify that your IsNull check is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


The Visible part does not work.

Dan Artuso said:
Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dan Artuso

Hi,
Dave, please step through your code to determine where the problem is.
To me the only possibility is that the
Text107.Visible = True
is never getting executed for some reason but the only way to know for sure
is if you step through it (or put a MsgBox in there). Once we know that, we can go from there.
--
HTH
Dan Artuso, Access MVP


Dave Elliott said:
I have on this form a comand button that prints the check and the code below
works for it.
So when the form opens or after a update or upon printing the check, then
the visible code needs to work.

If Not IsNull([ChkNoID]) Then
Text107.Visible = True
End If




Dan Artuso said:
Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become visible.
If you haven't stepped through it, do so to verify that your IsNull check is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


The Visible part does not work.

Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dave Elliott

There is no record source for this form, it is created thru code. The form
is opened from the code below from the form frmAutoPayrollReport
Example:
On Error GoTo Err_Label39_Click

Dte1 = Forms!frmAutoPayrollReport!BeginDate
Dte2 = Forms!frmAutoPayrollReport!EndDate
If IsNull(Forms!frmAutoPayrollReport!EmpOrCon) Then
DoCmd.GoToControl "EmpOrCon"
MsgBox "Select a Pay Status"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon < 4 Then
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT
QEmpTotPayWkB.*,QEmpTotPayWkB.EmpOrCon FROM QEmpTotPayWkB
WHERE(((QEmpTotPayWkB.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));
"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon = 4 Then 'Sales Commission
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "QSaleComTotWkC"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon > 4 Then '5=Bonus,
5.1=Reimbursement, 5.2=Misc.
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT QEmpBonusA.*,
QEmpBonusA.EmpOrCon FROM QEmpBonusA WHERE
(((QEmpBonusA.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));"
End If
Forms!frmAutoPayrollReport.Visible = False


Exit_Label39_Click:
Exit Sub

Err_Label39_Click:
MsgBox Err.Description
Resume Exit_Label39_Click


















Dan Artuso said:
Hi,
Dave, please step through your code to determine where the problem is.
To me the only possibility is that the
Text107.Visible = True
is never getting executed for some reason but the only way to know for sure
is if you step through it (or put a MsgBox in there). Once we know that, we can go from there.
--
HTH
Dan Artuso, Access MVP


I have on this form a comand button that prints the check and the code below
works for it.
So when the form opens or after a update or upon printing the check, then
the visible code needs to work.

If Not IsNull([ChkNoID]) Then
Text107.Visible = True
End If




Dan Artuso said:
Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become visible.
If you haven't stepped through it, do so to verify that your IsNull
check
is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


The Visible part does not work.

Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dan Artuso

Hi,
I don't think we're on the same page with this.
Exactly in which event do you have the code that does not work.
This will have nothing to do with the record source of the form.

What I'm asking you to do is to set a breakpoint within the code that does not work
so that you can step through it.
At least tell me if you understand what I'm asking you to do.

--
HTH
Dan Artuso, Access MVP


Dave Elliott said:
There is no record source for this form, it is created thru code. The form
is opened from the code below from the form frmAutoPayrollReport
Example:
On Error GoTo Err_Label39_Click

Dte1 = Forms!frmAutoPayrollReport!BeginDate
Dte2 = Forms!frmAutoPayrollReport!EndDate
If IsNull(Forms!frmAutoPayrollReport!EmpOrCon) Then
DoCmd.GoToControl "EmpOrCon"
MsgBox "Select a Pay Status"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon < 4 Then
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT
QEmpTotPayWkB.*,QEmpTotPayWkB.EmpOrCon FROM QEmpTotPayWkB
WHERE(((QEmpTotPayWkB.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));
"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon = 4 Then 'Sales Commission
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "QSaleComTotWkC"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon > 4 Then '5=Bonus,
5.1=Reimbursement, 5.2=Misc.
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT QEmpBonusA.*,
QEmpBonusA.EmpOrCon FROM QEmpBonusA WHERE
(((QEmpBonusA.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));"
End If
Forms!frmAutoPayrollReport.Visible = False


Exit_Label39_Click:
Exit Sub

Err_Label39_Click:
MsgBox Err.Description
Resume Exit_Label39_Click


















Dan Artuso said:
Hi,
Dave, please step through your code to determine where the problem is.
To me the only possibility is that the
Text107.Visible = True
is never getting executed for some reason but the only way to know for sure
is if you step through it (or put a MsgBox in there). Once we know that, we can go from there.
--
HTH
Dan Artuso, Access MVP


I have on this form a comand button that prints the check and the code below
works for it.
So when the form opens or after a update or upon printing the check, then
the visible code needs to work.

If Not IsNull([ChkNoID]) Then
Text107.Visible = True
End If




Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become visible.
If you haven't stepped through it, do so to verify that your IsNull check
is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


The Visible part does not work.

Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dave Elliott

No, not really . The code is on the Before Update Event.

Dan Artuso said:
Hi,
I don't think we're on the same page with this.
Exactly in which event do you have the code that does not work.
This will have nothing to do with the record source of the form.

What I'm asking you to do is to set a breakpoint within the code that does not work
so that you can step through it.
At least tell me if you understand what I'm asking you to do.

--
HTH
Dan Artuso, Access MVP


There is no record source for this form, it is created thru code. The form
is opened from the code below from the form frmAutoPayrollReport
Example:
On Error GoTo Err_Label39_Click

Dte1 = Forms!frmAutoPayrollReport!BeginDate
Dte2 = Forms!frmAutoPayrollReport!EndDate
If IsNull(Forms!frmAutoPayrollReport!EmpOrCon) Then
DoCmd.GoToControl "EmpOrCon"
MsgBox "Select a Pay Status"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon < 4 Then
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT
QEmpTotPayWkB.*,QEmpTotPayWkB.EmpOrCon FROM QEmpTotPayWkB
WHERE(((QEmpTotPayWkB.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));
"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon = 4 Then 'Sales Commission
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "QSaleComTotWkC"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon > 4 Then '5=Bonus,
5.1=Reimbursement, 5.2=Misc.
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT QEmpBonusA.*,
QEmpBonusA.EmpOrCon FROM QEmpBonusA WHERE
(((QEmpBonusA.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));"
End If
Forms!frmAutoPayrollReport.Visible = False


Exit_Label39_Click:
Exit Sub

Err_Label39_Click:
MsgBox Err.Description
Resume Exit_Label39_Click


















Dan Artuso said:
Hi,
Dave, please step through your code to determine where the problem is.
To me the only possibility is that the
Text107.Visible = True
is never getting executed for some reason but the only way to know for sure
is if you step through it (or put a MsgBox in there). Once we know
that,
we can go from there.
--
HTH
Dan Artuso, Access MVP


I have on this form a comand button that prints the check and the
code
below
works for it.
So when the form opens or after a update or upon printing the check, then
the visible code needs to work.

If Not IsNull([ChkNoID]) Then
Text107.Visible = True
End If




Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become visible.
If you haven't stepped through it, do so to verify that your
IsNull
check
is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


The Visible part does not work.

Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 
D

Dan Artuso

Hi,
I'll offer one last piece of advice.
Modify your code to:

If Not IsNull([ChkNoID]) Or Len([ChkNoID]) = 0 Then
Text107.Visible = True
End If

Place it the Current event of your from as well as the AfterUpdate event of ChkNoId.
Good Luck!
--
HTH
Dan Artuso, Access MVP


Dave Elliott said:
No, not really . The code is on the Before Update Event.

Dan Artuso said:
Hi,
I don't think we're on the same page with this.
Exactly in which event do you have the code that does not work.
This will have nothing to do with the record source of the form.

What I'm asking you to do is to set a breakpoint within the code that does not work
so that you can step through it.
At least tell me if you understand what I'm asking you to do.

--
HTH
Dan Artuso, Access MVP


There is no record source for this form, it is created thru code. The form
is opened from the code below from the form frmAutoPayrollReport
Example:
On Error GoTo Err_Label39_Click

Dte1 = Forms!frmAutoPayrollReport!BeginDate
Dte2 = Forms!frmAutoPayrollReport!EndDate
If IsNull(Forms!frmAutoPayrollReport!EmpOrCon) Then
DoCmd.GoToControl "EmpOrCon"
MsgBox "Select a Pay Status"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon < 4 Then
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT
QEmpTotPayWkB.*,QEmpTotPayWkB.EmpOrCon FROM QEmpTotPayWkB
WHERE(((QEmpTotPayWkB.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));
"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon = 4 Then 'Sales Commission
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "QSaleComTotWkC"
ElseIf Forms!frmAutoPayrollReport!EmpOrCon > 4 Then '5=Bonus,
5.1=Reimbursement, 5.2=Misc.
DoCmd.OpenForm "FEmpTotHours", acNormal, "", ""
[Forms]![FEmpTotHours].RecordSource = "SELECT QEmpBonusA.*,
QEmpBonusA.EmpOrCon FROM QEmpBonusA WHERE
(((QEmpBonusA.EmpOrCon)=[Forms]![frmAutoPayrollReport]![EmpOrCon]));"
End If
Forms!frmAutoPayrollReport.Visible = False


Exit_Label39_Click:
Exit Sub

Err_Label39_Click:
MsgBox Err.Description
Resume Exit_Label39_Click


















Hi,
Dave, please step through your code to determine where the problem is.
To me the only possibility is that the
Text107.Visible = True
is never getting executed for some reason but the only way to know for
sure
is if you step through it (or put a MsgBox in there). Once we know that,
we can go from there.
--
HTH
Dan Artuso, Access MVP


I have on this form a comand button that prints the check and the code
below
works for it.
So when the form opens or after a update or upon printing the check,
then
the visible code needs to work.

If Not IsNull([ChkNoID]) Then
Text107.Visible = True
End If




Hi,
I take it you've stepped through the code and verified that the line
Text107.Visible = True
is actually executed?
If that's the case, I'm at a loss as to why it does not become
visible.
If you haven't stepped through it, do so to verify that your IsNull
check
is
working as you expect it to.

--
HTH
Dan Artuso, Access MVP


The Visible part does not work.

Hi,
What part doesn't work?
The IsNull check or setting the Visible property?

Is it possible ChkNoA is an empty string ("") instead of Null?

--
HTH
Dan Artuso, Access MVP


If Not IsNull([ChkNoA) Then
Text107.Visible = True
End If

ChkNoA is a text box as well as Text107
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top