Provide option on which report to run (1 Viewer)

cclark9589

Registered User.
Local time
Today, 08:26
Joined
Sep 22, 2008
Messages
79
First off, to everyone (especially those who have helped me solve problems before) I would like to say Merry Christmas from my family to yours.

Access 2007. On my form "Jobs" there is a button to preview the invoice once the job is complete. I've got the code working so that depending on which Trust Fund the job belongs to determines which Invoice will display and then printed. Different Trust Funds have different benefit funds and the benefit funds get billed differing percentages of the total bill thus the requirement for different invoices.

One of these Trust Funds has a northern group and a southern group. One group has a DB & DC plan while the other group has only the DB plan. What I would like to do is once I click on the preview invoice button and the code determines which fund is involved a message box will pop up asking me if this job is northern, southern or both and then open the appropiate invoice.

Here is the code I'm using to determine which Fund is present:

On Error GoTo OpenInvoiceRpt_Click_Err

Dim strDocName As String
Dim strWhere As String
If Me!FundID = "12" Then
strDocName = "F12Invoices"
ElseIf Me!FundID = "40" Then
strDocName = "F40Invoices"
ElseIf Me!FundID = "33" Then
strDocName = "F33Invoices"
Else
strDocName = "Invoices"
End If
strWhere = "[JobID]=" & Me!JobID
Refresh
DoCmd.OpenReport strDocName, acPreview, , strWhere

Any ideas on how I might be able to accomplish this? Keep in mind I'm not real proficient with Access let alone VB. I know just enough to be dangerous not only to myself but those around me. :D

Thanks in advance for the help and again, have a very Merry Christmas and a Happy New Year.
 

boblarson

Smeghead
Local time
Today, 08:26
Joined
Jan 12, 2001
Messages
32,059
Not sure of your exact form set up, but you could possibly just put a combo box that has it's row source based on the text box and becomes enabled when the text box is updated. Then you can just open the report using the same click event but filtering based on the combo selection.
 

Users who are viewing this thread

Top Bottom