option Box Select visible data

L

Lez

Hi Guys,

I have a form the an option box that I want to select what data displays
subject to the option box selected. This is the code I am trying but it does
not work and fails, I am targeting correctly ? or is my problem something
else?

Private Sub Report_Open(Cancel As Integer)
With CodeContextObject
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader1.Visible = True
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader2.Visible = False
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader3.Visible = False
End If
End With
End Sub

Many thanks
Lez
 
F

fredg

Hi Guys,

I have a form the an option box that I want to select what data displays
subject to the option box selected. This is the code I am trying but it does
not work and fails, I am targeting correctly ? or is my problem something
else?

Private Sub Report_Open(Cancel As Integer)
With CodeContextObject
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader1.Visible = True
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader2.Visible = False
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader3.Visible = False
End If
End With
End Sub

Many thanks
Lez

All you need do is, in the GroupHeader1 Format event, code:
Cancel = forms!frmEditQuote!optPayType <> 1

In the GroupHeader2 Format event:
Cancel = forms!frmEditQuote!optPayType = 1

In the GroupHeader3 Format event:
Cancel = forms!frmEditQuote!optPayType = 1

What do you want to do if a different option is selected?

Note... The form must be open when this report is run.
 
L

Lez

Hi Fred,

Thanks for that. If option 2 then groupheader2 visible, 1 and 3 to be not
visible

Lez


fredg said:
Hi Guys,

I have a form the an option box that I want to select what data displays
subject to the option box selected. This is the code I am trying but it
does
not work and fails, I am targeting correctly ? or is my problem something
else?

Private Sub Report_Open(Cancel As Integer)
With CodeContextObject
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader1.Visible = True
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader2.Visible = False
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader3.Visible = False
End If
End With
End Sub

Many thanks
Lez

All you need do is, in the GroupHeader1 Format event, code:
Cancel = forms!frmEditQuote!optPayType <> 1

In the GroupHeader2 Format event:
Cancel = forms!frmEditQuote!optPayType = 1

In the GroupHeader3 Format event:
Cancel = forms!frmEditQuote!optPayType = 1

What do you want to do if a different option is selected?

Note... The form must be open when this report is run.
 
L

Lez

Hi Fred, sorted it now, thanks for that it was a real help :)
Lez

fredg said:
Hi Guys,

I have a form the an option box that I want to select what data displays
subject to the option box selected. This is the code I am trying but it
does
not work and fails, I am targeting correctly ? or is my problem something
else?

Private Sub Report_Open(Cancel As Integer)
With CodeContextObject
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader1.Visible = True
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader2.Visible = False
End If
If (.[frmEditQuote].[optPayType] = 1) Then
.GroupHeader3.Visible = False
End If
End With
End Sub

Many thanks
Lez

All you need do is, in the GroupHeader1 Format event, code:
Cancel = forms!frmEditQuote!optPayType <> 1

In the GroupHeader2 Format event:
Cancel = forms!frmEditQuote!optPayType = 1

In the GroupHeader3 Format event:
Cancel = forms!frmEditQuote!optPayType = 1

What do you want to do if a different option is selected?

Note... The form must be open when this report is run.
 

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