Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If then Else Help.

Status
Not open for further replies.

theif68

Technical User
Apr 3, 2005
39
US
Is there an easier way to do this? I have a list box and a button that will work of the selected box but there are a ton of entries....


If Me.ListContact = "Alphabetical Customer Listing" Then
DoCmd.OutputTo acOutputReport, "rptAlphabeticalContactListing", acFormatSNP, , yes

ElseIf Me.ListContact = "Calls NOT Made or Pending" Then
DoCmd.OutputTo acOutputReport, "rptContactsNOTcalledorpending", acFormatSNP, , yes

ElseIf Me.ListContact = "Customers by Selected Type" Then
DoCmd.OutputTo acOutputReport, "rptContactListingbySelectedType", acFormatSNP, , yes

ElseIf Me.ListContact = "Daily Calls Logged" Then
DoCmd.OutputTo acOutputReport, "rptDailyDateSpecificCallReport", acFormatSNP, , yes

ElseIf Me.ListContact = "Upcoming Call Listing" Then
DoCmd.OutputTo acOutputReport, "rptUpcomingCallSummary", acFormatSNP, , yes

ElseIf Me.ListContact = "Weekly Calls Logged" Then
DoCmd.OutputTo acOutputReport, "rptWeeklyCallListing", acFormatSNP, , yes
End If

MsgBox "Export Completed Successful", vbOKOnly

SnapshotError_Exit:
Exit Sub

Err_SnapshotError:
strMsg = " You have either Canceled this Action or have yet to select a Report."
MsgBox strMsg, vbCritical
Resume SnapshotError_Exit
 
Why not add a column in your listbox with the report name ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Add the actual report name to the row source of the listbox, let's say as the second column (hidden), then the following should do:

[tt]DoCmd.OutputTo acOutputReport, Me.ListContact.column(1), acFormatSNP, , true[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top