set input parameter & record source in vba

G

Guest

I have a report that I would like to set input variable via vb, however when
I set them it does not pass them to the procedure. What I am tryiny to
accomplish is if a reports date parameters are less then 10 days apart to use
the procedure that runs from a live data query. If it is greater then I want
it to use the datawarehouse procedure. Thanks in advance.

Private Sub Report_Open(Cancel As Integer)

Me.InputParameters =
"@CustomerN1=[Forms]![frmOnTimeDeliveryMgt]![CustomerN1],
@StartDate=[Forms]![frmOnTimeDeliveryMgt]![StartDate],
@EndDate=[Forms]![frmOnTimeDeliveryMgt]![EndDate]"

If Forms!frmOnTimeDeliveryMgt!EndDate -
Forms!frmOnTimeDeliveryMgt!StartDate > 10 Then
Me.RecordSource = "proc_OnTimeDeliveryTBL"
Else
Me.RecordSource = "proc_OntimeDelivery"
End If
DoCmd.Maximize
End Sub
 

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