Using a Macro to generate a Report from Button on Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello-

Here's what I'm working with:

F-Trips - Record Source(s): T-Trips, T-TripFlights, T-TripHotels,
T-TripCarRentals
[T-Trips].TripID
[T-Trips].Traveler
[T-Trips].StartDate
[T-Trips].EndDate...(etc)
ViewItineraryButton (On Click: M-ItineraryView)

M-ItineraryView
OpenReport
Report Name: R-TripItineraryView
Where Condition: [T-Trips]![TripID]=[Forms]![F-Trips]![TripID]
SelectObject
Object: Report
Name: R-TripItineraryView

R-TripItineraryView - ([T-Trips]![TripID]=[Forms]![F-Trips]![TripID])
TripID
Traveler
StartDate
EndDate

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

all of this only returns a blank report. yes, the report opens, but no data.
i'm basing this all on the [TripID] field, so i'm not sure what i'm missing.

i'm wondering if this is the result of null values - sometimes a rental car
will not be booked for a trip.

any thoughts?

/amelia
 
Amelia,

What is the Record Source of the Report? If you're not sure how to find
this information, look at the Property sheet of the report in design
view, and see what is entered in the Record Source property. Assuming
this is a query, can you post back with the SQL view of the query? If
you're not sure how to do this, open the design view of the query, and
then select SQL from the View menu.
 
RS for the Report =
SELECT [T-Trips].TripID, [T-Trips].StartDate, [T-Trips].EndDate,
[T-Trips].TripPurpose, [T-Trips].TripJob, [T-Trips].TripDestination,
[T-Contacts].FName & " " & [T-Contacts].LName AS FullName
FROM [T-Contacts] INNER JOIN [T-Trips] ON
[T-Contacts].ContactID=[T-Trips].Traveler;

the filtering for the report is in my original post as
([T-Trips]![TripID]=[Forms]![F-Trips]![TripID])

/aae
 
Amelia,

If you try to open this query as a datasheet (go to the design view of
the query, and click the toolbar button with the red [!] icon), does it
return the expected data? I can't immediately see anything drastically
wrong with what you have done, but I am suspicious of the join in the
query between [T-Contacts].ContactID and [T-Trips].Traveler. Is
Traveler really a numerical field which is the related value to the
ContactID?

Try in the Where Condition of your OpenReport action in the macro, to
just put it like this...
[TripID]=[Forms]![F-Trips]![TripID]

By the way, this is not related to the problem at all, but I would
recommend you avoid using a - as part of the name of your tables and forms.
 
Back
Top