Report Option Box

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
 
O

Ofer

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
 

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