Report not generating from the correct form?

WillJ

Registered User.
Local time
Today, 21:18
Joined
Oct 20, 2012
Messages
40
Hi Guys & Girls,

Hoping you can help me out here, I'm having a nightmare!

I have a booking sequence. Sales representatives take an order on a booking form and then then click a button to draw up the related report.

1)The form is showing all Booking forms, not the specific one just taken.
Do I need an OpenArgs statement? I've tried that but can't seem to get it to work.

Best,

William:banghead:
 
Do you set any filters or where condition?
Show the code you have.
 
This is from the Booking Form. It's a button on click event;

Code:
Private Sub btnTestPreviewReport_Click()
strBID = Me.BookingFormID
DoCmd.OpenReport "rptCBF", acViewNormal, , strBID, acWindowNormal
End Sub

This is the OnLoad statements I have in the rptCBF;

Code:
Private Sub Report_Load()
If Not IsNull(Me.OpenArgs) Then
  DoCmd.GoToRecord , , acNewRec
  Me.[BookingFormID] = Me.OpenArgs
End If
End Sub
 
It also goes straight to printing ...
No filters or anything set.
 
Apart from that would you expect the above code to pull up the related BookingFormId ... ?
 
No, like I said, the syntax is wrong. You have

Value

you need

FieldName = Value
 
Sorry, thanks Baldy, if I need any more help I'll ask.
Cheers :)
 
Hi Baldy,

Back again, by the way thank you for all your help and making your site available to everyone, it's straight forward and has really helped me develop (no pun intended);

I'm trying to get a Pdf to export based on the Booing form ID as you can see below the argument has the Where condition in the wrong place (I'm guessing). Where (no pun) should I place it?

Code:
Private Sub btnCBFSignOff_Click()
If DocumentSupplyID >= 1 Then
strFilePathAndFile = "C:\Users\William\Dropbox\Buisness\WC-Media Ltd\Accounts\Clients\Awaiting Signatory\CBF 2 Sign\"
DoCmd.OutputTo acOutputReport, "rptCBF", acFormantPDF, strFilePathAndFile & PDFLink & "CBFID." & [BookingFormID] & ".pdf", "BookingFormID = " & Me.BookingFormID
Else
MsgBox "WARNING: You have not supplied a document supply ID. Please select the relvant documents and re-submit!"
End If
End Sub
 
Last edited:
Thanks, I'm glad it helped you.

The argument is in the wrong place because OutputTo has no such argument. ;)

Options include opening the report in preview mode with the wherecondition (can be hidden), then outputting, then closing the report, or a technique like this to let the report filter itself:

http://www.granite.ab.ca/access/email/reporttomultiplerecipients.htm

I lean towards the second, particularly in loops, to prevent the overhead of opening/closing the report, but you might not see a performance difference.
 

Users who are viewing this thread

Back
Top Bottom