EASY CK BOX question I THINK!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a unbound ck box that turns off my supplier code field if the code is
NOT the correct code that time for the item. The person would then enter the
code in the description field. I need the surpressed code to NOT print on the
report. This is in a subform and the problems are:

1) it is not just turning off supplier code in only 1 record it is turning
of all records in the subform. (I need each record to have the choice do I
need to make it bound instead since it is a continuous form)

2) How do I code the criteria in the VBA to SHOW "nothing" on the report if
the box is checked? (at this time when I clk my report button I still see the
supplier code field)

Code:
Private Sub ckCodeOFF_AfterUpdate()
If Me.ckCodeOFF = True Then
Me.SupplierCode.Enabled = False
Me.SupplierCode.Visible = False
Else
Me.SupplierCode.Enabled = True
Me.SupplierCode.Visible = True
End If

End Sub
---
Above code also in child not in parent.

Private Sub Form_Current()

THANKS!
 
You will need to make this a bound check box, so that the database can
associate the check box with the correct record. The code you have will then
hide it on the sub form, but you will also have to put the same code in the
on current event of the subform for it to work properly. For your report,
you will need to add something like

Me![SupplierCode].Visible = not Me![ckCodeOFF]

in the on format event of the detail section of the report
 
Thanks... but it still isn't working right. I already had it in the current
of the sub and I made it bound but it still shuts them all off. And I tried
adding the code to the detail of the report but it didn't turn that off
either. Maybe I am not doing something right. ??

schasteen said:
You will need to make this a bound check box, so that the database can
associate the check box with the correct record. The code you have will then
hide it on the sub form, but you will also have to put the same code in the
on current event of the subform for it to work properly. For your report,
you will need to add something like

Me![SupplierCode].Visible = not Me![ckCodeOFF]

in the on format event of the detail section of the report

lmv said:
I have a unbound ck box that turns off my supplier code field if the code is
NOT the correct code that time for the item. The person would then enter the
code in the description field. I need the surpressed code to NOT print on the
report. This is in a subform and the problems are:

1) it is not just turning off supplier code in only 1 record it is turning
of all records in the subform. (I need each record to have the choice do I
need to make it bound instead since it is a continuous form)

2) How do I code the criteria in the VBA to SHOW "nothing" on the report if
the box is checked? (at this time when I clk my report button I still see the
supplier code field)

Code:
Private Sub ckCodeOFF_AfterUpdate()
If Me.ckCodeOFF = True Then
Me.SupplierCode.Enabled = False
Me.SupplierCode.Visible = False
Else
Me.SupplierCode.Enabled = True
Me.SupplierCode.Visible = True
End If

End Sub
---
Above code also in child not in parent.

Private Sub Form_Current()

THANKS!
 
It must be bound in some way to avoid the repetition
might be simpler to use a multi-select listbox to achieve the task at hand
though

Pieter

lmv said:
I have a unbound ck box that turns off my supplier code field if the code
is
NOT the correct code that time for the item. The person would then enter
the
code in the description field. I need the surpressed code to NOT print on
the
report. This is in a subform and the problems are:

1) it is not just turning off supplier code in only 1 record it is turning
of all records in the subform. (I need each record to have the choice do I
need to make it bound instead since it is a continuous form)

2) How do I code the criteria in the VBA to SHOW "nothing" on the report
if
the box is checked? (at this time when I clk my report button I still see
the
supplier code field)

Code:
Private Sub ckCodeOFF_AfterUpdate()
If Me.ckCodeOFF = True Then
Me.SupplierCode.Enabled = False
Me.SupplierCode.Visible = False
Else
Me.SupplierCode.Enabled = True
Me.SupplierCode.Visible = True
End If

End Sub
---
Above code also in child not in parent.

Private Sub Form_Current()

THANKS!



--
 
It must be bound in some way to avoid the repetition
might be simpler to use a multi-select listbox to achieve the task at hand
though

Pieter
 
Not sure what may be wrong. Please give details of what it is or isn't
doing. It is hard to guess since we can't see your database.

lmv said:
Thanks... but it still isn't working right. I already had it in the current
of the sub and I made it bound but it still shuts them all off. And I tried
adding the code to the detail of the report but it didn't turn that off
either. Maybe I am not doing something right. ??

schasteen said:
You will need to make this a bound check box, so that the database can
associate the check box with the correct record. The code you have will then
hide it on the sub form, but you will also have to put the same code in the
on current event of the subform for it to work properly. For your report,
you will need to add something like

Me![SupplierCode].Visible = not Me![ckCodeOFF]

in the on format event of the detail section of the report

lmv said:
I have a unbound ck box that turns off my supplier code field if the code is
NOT the correct code that time for the item. The person would then enter the
code in the description field. I need the surpressed code to NOT print on the
report. This is in a subform and the problems are:

1) it is not just turning off supplier code in only 1 record it is turning
of all records in the subform. (I need each record to have the choice do I
need to make it bound instead since it is a continuous form)

2) How do I code the criteria in the VBA to SHOW "nothing" on the report if
the box is checked? (at this time when I clk my report button I still see the
supplier code field)

Code:
Private Sub ckCodeOFF_AfterUpdate()
If Me.ckCodeOFF = True Then
Me.SupplierCode.Enabled = False
Me.SupplierCode.Visible = False
Else
Me.SupplierCode.Enabled = True
Me.SupplierCode.Visible = True
End If

End Sub
---
Above code also in child not in parent.

Private Sub Form_Current()

THANKS!
 

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

Back
Top