Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / April 2008

Tip: Looking for answers? Try searching our database.

Command Button to run a query that updates a report to preview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 29 Apr 2008 20:08 GMT
Hello all!  I'd like to thank all of you that are helping guys like me get
ahead in Access.  I was wondering if there was a way that I could create a
Command Button that will first run an update table query and once that query
has successfully run, I would like for this command to also bring up a print
preview of a report that was just updated by this command button.  Is this
possible and if so, how could I make this happen?
Maurice - 29 Apr 2008 20:45 GMT
Mike,

I assume your report is bound to the updated table so that wouldn't be to
hard.

Create the update query and save the query.
Create a button on your form and place the following in de code behind the
button (between the Sub and End Sub)

----------------
DoCmd.SetWarnings False '- prevent the message you are about to....
 DoCmd.OpenQuery "your queryname here"
DoCmd.SetWarnings True '- set warnings back on...

DoCmd.OpenReport "your reportname here.."

------------
if you don't want the hassle of the warnings and want to use Jet directly
then place the following in the code:

Currentdb.Execute "your queryname here", dbFailOnError
DoCmd.OpenReport "your reportname here.."

hth

Signature

Maurice Ausum

> Hello all!  I'd like to thank all of you that are helping guys like me get
> ahead in Access.  I was wondering if there was a way that I could create a
> Command Button that will first run an update table query and once that query
> has successfully run, I would like for this command to also bring up a print
> preview of a report that was just updated by this command button.  Is this
> possible and if so, how could I make this happen?
Mike - 30 Apr 2008 21:19 GMT
Hi Maurice, thanks soo much for your help!  It worked like a charm.  You were
very helpful.  Thanks again and have a great day!

Michael

> Mike,
>
[quoted text clipped - 27 lines]
> > preview of a report that was just updated by this command button.  Is this
> > possible and if so, how could I make this happen?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.