A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Hide Columns in a datasheet Subform based on a another field value



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2009, 03:26 AM posted to microsoft.public.access.forms
Nurse Nancy
external usenet poster
 
Posts: 67
Default Hide Columns in a datasheet Subform based on a another field value

Hi
Can anyone provide me with some much needed guidance. I am VB challenged!!!

I have a form in datasheet view that displays many columns based on a query

Basically the users first fill out a form with information about an upcoming
advertising campaign.

They enter a campaign start date and the number of weeks for it to run.
There are many queries that run to select Radio Station and them to a
Prospective Buy Table.

Then they use another form where they fill out buy and post information for
each week of the campaign.

Some stations agree to run the ads for the entire campaign
Some stations agree to run some of the weeks up fron depending on their
schedule
Some stations decide each week if they will participate in the Campaign for
the next week.

So the users wanted check boxes for each week, so they could check them
ahead of time if they know upfront that a station is confirming for future
weeks.

On my form I have 6 checkboxes ( Wk1Chkbox, Wk2ChkBox, Wk3ChkBox, .....)
because the max a campaign can run is 6 weeks.

I hide all but Wk1 when the form is opened

Then I have a checkbox called WkChkBox that will unhide the remaining 5
weeks if they Check it.

My problem is,, if the total number of weeks the campaign is to run is less
than 6, (lets say 3 weeks) Then, I only want to show check boxes Wk1, Wk2,
Wk3 when they check the Box to Unhide.

Below is my code for hiding the checkboxes on Entering the Subform
the field that I need to use for comparing is NumWeeksTB

Anybody have suggestion on how to code it so I only show the checkboxes if
they are not greater than NumbWeeksTB?


Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))

End Sub


--
Nurse Nancy
  #2  
Old December 2nd, 2009, 03:04 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Hide Columns in a datasheet Subform based on a another field value

Nurse Nancy -

Try this for your subroutine. It will also check the number of weeks:

Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 1)
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 2)
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 3)
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 4)
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 5)

End Sub

--
Daryl S


"Nurse Nancy" wrote:

Hi
Can anyone provide me with some much needed guidance. I am VB challenged!!!

I have a form in datasheet view that displays many columns based on a query

Basically the users first fill out a form with information about an upcoming
advertising campaign.

They enter a campaign start date and the number of weeks for it to run.
There are many queries that run to select Radio Station and them to a
Prospective Buy Table.

Then they use another form where they fill out buy and post information for
each week of the campaign.

Some stations agree to run the ads for the entire campaign
Some stations agree to run some of the weeks up fron depending on their
schedule
Some stations decide each week if they will participate in the Campaign for
the next week.

So the users wanted check boxes for each week, so they could check them
ahead of time if they know upfront that a station is confirming for future
weeks.

On my form I have 6 checkboxes ( Wk1Chkbox, Wk2ChkBox, Wk3ChkBox, .....)
because the max a campaign can run is 6 weeks.

I hide all but Wk1 when the form is opened

Then I have a checkbox called WkChkBox that will unhide the remaining 5
weeks if they Check it.

My problem is,, if the total number of weeks the campaign is to run is less
than 6, (lets say 3 weeks) Then, I only want to show check boxes Wk1, Wk2,
Wk3 when they check the Box to Unhide.

Below is my code for hiding the checkboxes on Entering the Subform
the field that I need to use for comparing is NumWeeksTB

Anybody have suggestion on how to code it so I only show the checkboxes if
they are not greater than NumbWeeksTB?


Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))

End Sub


--
Nurse Nancy

  #3  
Old December 2nd, 2009, 03:04 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Hide Columns in a datasheet Subform based on a another field value

Nurse Nancy -

Try this for your subroutine. It will also check the number of weeks:

Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 1)
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 2)
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 3)
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 4)
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 5)

End Sub

--
Daryl S


"Nurse Nancy" wrote:

Hi
Can anyone provide me with some much needed guidance. I am VB challenged!!!

I have a form in datasheet view that displays many columns based on a query

Basically the users first fill out a form with information about an upcoming
advertising campaign.

They enter a campaign start date and the number of weeks for it to run.
There are many queries that run to select Radio Station and them to a
Prospective Buy Table.

Then they use another form where they fill out buy and post information for
each week of the campaign.

Some stations agree to run the ads for the entire campaign
Some stations agree to run some of the weeks up fron depending on their
schedule
Some stations decide each week if they will participate in the Campaign for
the next week.

So the users wanted check boxes for each week, so they could check them
ahead of time if they know upfront that a station is confirming for future
weeks.

On my form I have 6 checkboxes ( Wk1Chkbox, Wk2ChkBox, Wk3ChkBox, .....)
because the max a campaign can run is 6 weeks.

I hide all but Wk1 when the form is opened

Then I have a checkbox called WkChkBox that will unhide the remaining 5
weeks if they Check it.

My problem is,, if the total number of weeks the campaign is to run is less
than 6, (lets say 3 weeks) Then, I only want to show check boxes Wk1, Wk2,
Wk3 when they check the Box to Unhide.

Below is my code for hiding the checkboxes on Entering the Subform
the field that I need to use for comparing is NumWeeksTB

Anybody have suggestion on how to code it so I only show the checkboxes if
they are not greater than NumbWeeksTB?


Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))

End Sub


--
Nurse Nancy

  #4  
Old December 2nd, 2009, 03:04 PM posted to microsoft.public.access.forms
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Hide Columns in a datasheet Subform based on a another field value

Nurse Nancy -

Try this for your subroutine. It will also check the number of weeks:

Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 1)
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 2)
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 3)
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 4)
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = (Not
(Nz(Me.WkChkBox, 0)) AND Me.NumWeeksTB 5)

End Sub

--
Daryl S


"Nurse Nancy" wrote:

Hi
Can anyone provide me with some much needed guidance. I am VB challenged!!!

I have a form in datasheet view that displays many columns based on a query

Basically the users first fill out a form with information about an upcoming
advertising campaign.

They enter a campaign start date and the number of weeks for it to run.
There are many queries that run to select Radio Station and them to a
Prospective Buy Table.

Then they use another form where they fill out buy and post information for
each week of the campaign.

Some stations agree to run the ads for the entire campaign
Some stations agree to run some of the weeks up fron depending on their
schedule
Some stations decide each week if they will participate in the Campaign for
the next week.

So the users wanted check boxes for each week, so they could check them
ahead of time if they know upfront that a station is confirming for future
weeks.

On my form I have 6 checkboxes ( Wk1Chkbox, Wk2ChkBox, Wk3ChkBox, .....)
because the max a campaign can run is 6 weeks.

I hide all but Wk1 when the form is opened

Then I have a checkbox called WkChkBox that will unhide the remaining 5
weeks if they Check it.

My problem is,, if the total number of weeks the campaign is to run is less
than 6, (lets say 3 weeks) Then, I only want to show check boxes Wk1, Wk2,
Wk3 when they check the Box to Unhide.

Below is my code for hiding the checkboxes on Entering the Subform
the field that I need to use for comparing is NumWeeksTB

Anybody have suggestion on how to code it so I only show the checkboxes if
they are not greater than NumbWeeksTB?


Private Sub Weekly_Buy_Query_subform_Enter()

Me.Weekly_Buy_Query_subform.Form.Wk2ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk3ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk4ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk5ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))
Me.Weekly_Buy_Query_subform.Form.Wk6ChkBox.ColumnH idden = Not
(Nz(Me.WkChkBox, 0))

End Sub


--
Nurse Nancy

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.