Hi. I have an button that opens a report when clicked. Here is the code associated with the button:
Private Sub Preview_Med_Expense_rpt_Click()
DoCmd.OpenReport "rptMedExpense", acPreview, , IIf(Me.FilterOn = True, Me.Filter, "")
Me.FilterOn = False
End Sub
It works fine, but I need it to do two more things:
In the report:
Sort the records (A-Z) in the report by a field called "MedDateInitial"
In the current form:
Stay in the current record after all this is executed. Right now after I click the button, it automatically goes back to the first record. I need it to stay in the current record.
I'm hoping this will just be a couple more lines in the code. If anyone could modify the code so it will do this, I'd really appreciate it.
thanks for any help,
-Emery
Private Sub Preview_Med_Expense_rpt_Click()
DoCmd.OpenReport "rptMedExpense", acPreview, , IIf(Me.FilterOn = True, Me.Filter, "")
Me.FilterOn = False
End Sub
It works fine, but I need it to do two more things:
In the report:
Sort the records (A-Z) in the report by a field called "MedDateInitial"
In the current form:
Stay in the current record after all this is executed. Right now after I click the button, it automatically goes back to the first record. I need it to stay in the current record.
I'm hoping this will just be a couple more lines in the code. If anyone could modify the code so it will do this, I'd really appreciate it.
thanks for any help,
-Emery