Report Option Box

  • Thread starter Thread starter LJG
  • Start date Start date
L

LJG

I have an option box on a form, which has a print report button, When I run
the report I want the chosen value of various fields to be added to the
report, trouble I am having is adding the code to choose the value I need.

My sample code is below:

Private Sub Report_Open(Cancel As Integer)
With CodeContextObject
If (.Forms![frmEditQuote]![optPayType] = 1) Then
Me.txtDeposit = Forms![frmEditQuote]![txt3yrdepTotal]
If (.Forms![frmEditQuote]![optPayType] = 2) Then
Me.txtDeposit = Forms![frmEditQuote]![txt5yrdepTotal]
End If
End If
End With
End Sub

Anyone help please ?

Les
 
Try writing as follow
Private Sub Report_Open(Cancel As Integer)
If (.Forms![frmEditQuote]![optPayType] = 1) Then
Me.txtDeposit = Forms![frmEditQuote]![txt3yrdepTotal]
ELSE
If (.Forms![frmEditQuote]![optPayType] = 2) Then
Me.txtDeposit = Forms![frmEditQuote]![txt5yrdepTotal]
End If
End If
End Sub
LJG said:
I have an option box on a form, which has a print report button, When I run
the report I want the chosen value of various fields to be added to the
report, trouble I am having is adding the code to choose the value I need.

My sample code is below:

Private Sub Report_Open(Cancel As Integer)
With CodeContextObject
If (.Forms![frmEditQuote]![optPayType] = 1) Then
Me.txtDeposit = Forms![frmEditQuote]![txt3yrdepTotal]
If (.Forms![frmEditQuote]![optPayType] = 2) Then
Me.txtDeposit = Forms![frmEditQuote]![txt5yrdepTotal]
End If
End If
End With
End Sub

Anyone help please ?

Les
 
Back
Top