Chaning a pre-built query's information

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

Guest

I have a report that runs off of the query "qryPrintOBR" that's saved as a
query in the database window. How do I change the query information through
VBA when the user presses the button to print the selected information?

I can't figure out how to pass thr values derived through using the VBA code
to the query that's been saved.

-Thanks in advance.
 
I want to change what records it searches by in the ID field so when the
report opens for printing, it only views the records with the ID that the
user selected.

Right now I have a report, but when it opens, it has all records. The report
runs off of qryPrintOBR and I want to update qryPrintOBR via the SQL
statement I have in the code.
 
try using just a filter like this:

dim ReportName As String
dim FilterText As String

ReportName = "myReportName"
FilterText = "[Staff_ID]=" & Me![Staff_ID]

DoCmd.OpenReport ReportName, acPreview, , FilterText

This is asuming the field name for the ID is the same in the query and in
the form.
 
Back
Top