Using Code from one form to another question

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

Dave Elliott

This code is used to make a field visible on a form named FEmpTotHours
It works. I would like for the same code to inform me from another form
named frmAutoPayrollReport
if there are checks to be printed from the form FEmpTotHours
I placed the same Text340 box on my form frmAutoPayrollReport as I did the
form FEmpTotHours
How can I make this work? It needs to reference the other form. ChkNoID is
on the form FEmpTotHours
Text340 is on both forms.

If Not IsNull([ChkNoID]) Then
Text340.Visible = True
Else
Text340.Visible = False
End If
 
Not 100% certain I'm understanding where everything is, but see if this gets
you closer:

If Not IsNull(Forms!FEmpTotHours![ChkNoID]) Then
Text340.Visible = True
Else
Text340.Visible = False
End If
 
Will this code work on another form (frmAutoPayrollReport) besides the form
that it is designed for(FEmpTotHours)? Even though it references another
form?
Right now it does not work.
The code is used on a form named FEmpTotHours and works fine
I also want it to work on my main form and tell me if this other form
FEmpTotHours (ChkNoID) isNull, Therefore I have checks to print.
Hope this makes it clearer...
Thanks


Ken Snell said:
Not 100% certain I'm understanding where everything is, but see if this
gets
you closer:

If Not IsNull(Forms!FEmpTotHours![ChkNoID]) Then
Text340.Visible = True
Else
Text340.Visible = False
End If


--

Ken Snell
<MS ACCESS MVP>

Dave Elliott said:
This code is used to make a field visible on a form named
FEmpTotHours
It works. I would like for the same code to inform me from another form
named frmAutoPayrollReport
if there are checks to be printed from the form FEmpTotHours
I placed the same Text340 box on my form frmAutoPayrollReport as I did the
form FEmpTotHours
How can I make this work? It needs to reference the other form. ChkNoID
is
on the form FEmpTotHours
Text340 is on both forms.

If Not IsNull([ChkNoID]) Then
Text340.Visible = True
Else
Text340.Visible = False
End If
 
OK, better explanation , new course of action.
The table where the control ChkNoID is located is TCheckNo
If ChkNoID isNull then Text340.visible = True
Else
Text340.Visble= False
 
So long as the FEmpTotHours form is open when you'd want to use this code in
the frmAutoPayrollReport form, it should work, yes.


--

Ken Snell
<MS ACCESS MVP>

Dave Elliott said:
Will this code work on another form (frmAutoPayrollReport) besides the form
that it is designed for(FEmpTotHours)? Even though it references another
form?
Right now it does not work.
The code is used on a form named FEmpTotHours and works fine
I also want it to work on my main form and tell me if this other form
FEmpTotHours (ChkNoID) isNull, Therefore I have checks to print.
Hope this makes it clearer...
Thanks


Ken Snell said:
Not 100% certain I'm understanding where everything is, but see if this
gets
you closer:

If Not IsNull(Forms!FEmpTotHours![ChkNoID]) Then
Text340.Visible = True
Else
Text340.Visible = False
End If


--

Ken Snell
<MS ACCESS MVP>

Dave Elliott said:
This code is used to make a field visible on a form named
FEmpTotHours
It works. I would like for the same code to inform me from another form
named frmAutoPayrollReport
if there are checks to be printed from the form FEmpTotHours
I placed the same Text340 box on my form frmAutoPayrollReport as I did the
form FEmpTotHours
How can I make this work? It needs to reference the other form. ChkNoID
is
on the form FEmpTotHours
Text340 is on both forms.

If Not IsNull([ChkNoID]) Then
Text340.Visible = True
Else
Text340.Visible = False
End If
 
Back
Top