Problem hiding fields

R

Rodney

I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 
D

Duane Hookom

You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
 
R

Rodney

Duane,
Thanks for the reply.
Will this work if I have the combine text field with rank, first name, last
name ect as I need to have the combine text so I get the correct spacing on
the certificate.
What I currently have will not work with the combine text field the error
says it can't find Employstatus.

Thanks
Rodney

Duane Hookom said:
You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
--
Duane Hookom
Microsoft Access MVP


Rodney said:
I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 
D

Duane Hookom

I am confused as to your logic/rules and what you want to display or hide. In
code, you need to reference control names. I expect you don't have a control
named "Employstatus".

If you want to do this without code, you can set a control source like:

=IIf(...your condition...., [RankLong] & " " & Left([FirstName],1) & "." & "
" & Left([OtherName],1) & "." & " " & [LastName] & "," & " " &
[StudentPMKeysNumber] & "" & [EmployStatus], Null)



--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
Thanks for the reply.
Will this work if I have the combine text field with rank, first name, last
name ect as I need to have the combine text so I get the correct spacing on
the certificate.
What I currently have will not work with the combine text field the error
says it can't find Employstatus.

Thanks
Rodney

Duane Hookom said:
You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
--
Duane Hookom
Microsoft Access MVP


Rodney said:
I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 
R

Rodney

Duane,
Sorry
Yes I do have controls for Ranklong, Firstname, Othername, Lastname,
StudentPMKeysNumber, and Employstatus but they are not on the report they are
in a combined text box called studentdetails which is
=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &[StudentPMKeysNumber] & "" &
[EmployStatus]

I also have the following code on the reports detail_event_format which
works fine if I have the controls on the report but I don't I have then in
the above combine text box called studentdetails. Is their any way that I can
direct the below code to the above combine text box.
I have three posibilities that it could be as in the code below.

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
If (Me!CourseFullNames.Value = "Chief Petty Officers Development
Programe") Then
Me!EmployStatus.Visible = False
ElseIf (Me!CourseFullNames.Value = "Senior Sailors Management Course")
Then
Me!EmployStatus.Visible = False
Else
Me!EmployStatus.Visible = True
Me!StudentPMKeysNumber.Visible = False
End If
End Sub

I have tryed a previous example and it seems to hide the hole combine text
box.
Hope you can help
Thank you
Rodney


Duane Hookom said:
I am confused as to your logic/rules and what you want to display or hide. In
code, you need to reference control names. I expect you don't have a control
named "Employstatus".

If you want to do this without code, you can set a control source like:

=IIf(...your condition...., [RankLong] & " " & Left([FirstName],1) & "." & "
" & Left([OtherName],1) & "." & " " & [LastName] & "," & " " &
[StudentPMKeysNumber] & "" & [EmployStatus], Null)



--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
Thanks for the reply.
Will this work if I have the combine text field with rank, first name, last
name ect as I need to have the combine text so I get the correct spacing on
the certificate.
What I currently have will not work with the combine text field the error
says it can't find Employstatus.

Thanks
Rodney

Duane Hookom said:
You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
--
Duane Hookom
Microsoft Access MVP


:

I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 
D

Duane Hookom

I finally realized you wanted to always display the first part of the
concatenated string. Try something like:

=[RankLong] & " " & Left([FirstName],1) & ". " & Left([OtherName],1) & ". "
& [LastName] & "," & " " & [StudentPMKeysNumber] & "" & IIf(...your
condition...., & [EmployStatus], "")

--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
Sorry
Yes I do have controls for Ranklong, Firstname, Othername, Lastname,
StudentPMKeysNumber, and Employstatus but they are not on the report they are
in a combined text box called studentdetails which is
=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &[StudentPMKeysNumber] & "" &
[EmployStatus]

I also have the following code on the reports detail_event_format which
works fine if I have the controls on the report but I don't I have then in
the above combine text box called studentdetails. Is their any way that I can
direct the below code to the above combine text box.
I have three posibilities that it could be as in the code below.

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
If (Me!CourseFullNames.Value = "Chief Petty Officers Development
Programe") Then
Me!EmployStatus.Visible = False
ElseIf (Me!CourseFullNames.Value = "Senior Sailors Management Course")
Then
Me!EmployStatus.Visible = False
Else
Me!EmployStatus.Visible = True
Me!StudentPMKeysNumber.Visible = False
End If
End Sub

I have tryed a previous example and it seems to hide the hole combine text
box.
Hope you can help
Thank you
Rodney


Duane Hookom said:
I am confused as to your logic/rules and what you want to display or hide. In
code, you need to reference control names. I expect you don't have a control
named "Employstatus".

If you want to do this without code, you can set a control source like:

=IIf(...your condition...., [RankLong] & " " & Left([FirstName],1) & "." & "
" & Left([OtherName],1) & "." & " " & [LastName] & "," & " " &
[StudentPMKeysNumber] & "" & [EmployStatus], Null)



--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
Thanks for the reply.
Will this work if I have the combine text field with rank, first name, last
name ect as I need to have the combine text so I get the correct spacing on
the certificate.
What I currently have will not work with the combine text field the error
says it can't find Employstatus.

Thanks
Rodney

:

You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
--
Duane Hookom
Microsoft Access MVP


:

I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 
R

Rodney

Duane,
All most
What I want to do is display [Ranklong] & [Firstname] & [othername] &
[lastname] all the time and [StudentPMKeysnumber] I only want to display if
[coursefullnames] IS = TO "Chief Petty Officers Development Programe" or
"Senior Sailors Management Course"
and I only want [Employstatus] to display if [Coursefullnames] IS NOT = TO
"Chief Petty Officers Development Programe" or "Senior Sailors Management
Course"

Thanks for your help again
Rodney

Duane Hookom said:
I finally realized you wanted to always display the first part of the
concatenated string. Try something like:

=[RankLong] & " " & Left([FirstName],1) & ". " & Left([OtherName],1) & ". "
& [LastName] & "," & " " & [StudentPMKeysNumber] & "" & IIf(...your
condition...., & [EmployStatus], "")

--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
Sorry
Yes I do have controls for Ranklong, Firstname, Othername, Lastname,
StudentPMKeysNumber, and Employstatus but they are not on the report they are
in a combined text box called studentdetails which is
=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &[StudentPMKeysNumber] & "" &
[EmployStatus]

I also have the following code on the reports detail_event_format which
works fine if I have the controls on the report but I don't I have then in
the above combine text box called studentdetails. Is their any way that I can
direct the below code to the above combine text box.
I have three posibilities that it could be as in the code below.

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
If (Me!CourseFullNames.Value = "Chief Petty Officers Development
Programe") Then
Me!EmployStatus.Visible = False
ElseIf (Me!CourseFullNames.Value = "Senior Sailors Management Course")
Then
Me!EmployStatus.Visible = False
Else
Me!EmployStatus.Visible = True
Me!StudentPMKeysNumber.Visible = False
End If
End Sub

I have tryed a previous example and it seems to hide the hole combine text
box.
Hope you can help
Thank you
Rodney


Duane Hookom said:
I am confused as to your logic/rules and what you want to display or hide. In
code, you need to reference control names. I expect you don't have a control
named "Employstatus".

If you want to do this without code, you can set a control source like:

=IIf(...your condition...., [RankLong] & " " & Left([FirstName],1) & "." & "
" & Left([OtherName],1) & "." & " " & [LastName] & "," & " " &
[StudentPMKeysNumber] & "" & [EmployStatus], Null)



--
Duane Hookom
Microsoft Access MVP


:

Duane,
Thanks for the reply.
Will this work if I have the combine text field with rank, first name, last
name ect as I need to have the combine text so I get the correct spacing on
the certificate.
What I currently have will not work with the combine text field the error
says it can't find Employstatus.

Thanks
Rodney

:

You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
--
Duane Hookom
Microsoft Access MVP


:

I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 
D

Duane Hookom

I have shown you how the IIf() can work as part of a control source. All you
need to do is apply it to your situation.
--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
All most
What I want to do is display [Ranklong] & [Firstname] & [othername] &
[lastname] all the time and [StudentPMKeysnumber] I only want to display if
[coursefullnames] IS = TO "Chief Petty Officers Development Programe" or
"Senior Sailors Management Course"
and I only want [Employstatus] to display if [Coursefullnames] IS NOT = TO
"Chief Petty Officers Development Programe" or "Senior Sailors Management
Course"

Thanks for your help again
Rodney

Duane Hookom said:
I finally realized you wanted to always display the first part of the
concatenated string. Try something like:

=[RankLong] & " " & Left([FirstName],1) & ". " & Left([OtherName],1) & ". "
& [LastName] & "," & " " & [StudentPMKeysNumber] & "" & IIf(...your
condition...., & [EmployStatus], "")

--
Duane Hookom
Microsoft Access MVP


Rodney said:
Duane,
Sorry
Yes I do have controls for Ranklong, Firstname, Othername, Lastname,
StudentPMKeysNumber, and Employstatus but they are not on the report they are
in a combined text box called studentdetails which is
=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &[StudentPMKeysNumber] & "" &
[EmployStatus]

I also have the following code on the reports detail_event_format which
works fine if I have the controls on the report but I don't I have then in
the above combine text box called studentdetails. Is their any way that I can
direct the below code to the above combine text box.
I have three posibilities that it could be as in the code below.

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
If (Me!CourseFullNames.Value = "Chief Petty Officers Development
Programe") Then
Me!EmployStatus.Visible = False
ElseIf (Me!CourseFullNames.Value = "Senior Sailors Management Course")
Then
Me!EmployStatus.Visible = False
Else
Me!EmployStatus.Visible = True
Me!StudentPMKeysNumber.Visible = False
End If
End Sub

I have tryed a previous example and it seems to hide the hole combine text
box.
Hope you can help
Thank you
Rodney


:

I am confused as to your logic/rules and what you want to display or hide. In
code, you need to reference control names. I expect you don't have a control
named "Employstatus".

If you want to do this without code, you can set a control source like:

=IIf(...your condition...., [RankLong] & " " & Left([FirstName],1) & "." & "
" & Left([OtherName],1) & "." & " " & [LastName] & "," & " " &
[StudentPMKeysNumber] & "" & [EmployStatus], Null)



--
Duane Hookom
Microsoft Access MVP


:

Duane,
Thanks for the reply.
Will this work if I have the combine text field with rank, first name, last
name ect as I need to have the combine text so I get the correct spacing on
the certificate.
What I currently have will not work with the combine text field the error
says it can't find Employstatus.

Thanks
Rodney

:

You have two Ifs and only one End If. You might be able to do this without
code using a control source like:
=IIf([CourseFullNames]="Senior....",Null, [EmployStatus])
If you make sure you have an End If for each If and don't nest them (unless
needed) then your code should work.
--
Duane Hookom
Microsoft Access MVP


:

I have the following on a report in the detail_format_event properties field.


Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

End If

End Sub

This works fine if EmployStatus has its own control, but I have it in a
combine text field.

Is it still posible to do this.

This is my combine text field

=[RankLong] & " " & Left([FirstName],1) & "." & " " & Left([OtherName],1) &
"." & " " & [LastName] & "," & " " &

[StudentPMKeysNumber] & "" & [EmployStatus]

I am trying to achieve the following

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)

If (Me!CourseFullNames.Value = "Senior Sailors Management Course") Then

Me!EmployStatus.Visible = False

If (Me!CourseFullNames.Value = "New Entry Officer Course") Then

Me!StudentPMKeysNumber.Visible = False

End If

End Sub

Any help would be great.

Thanks
Rod
 

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