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 / May 2007

Tip: Looking for answers? Try searching our database.

VB code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amateur - 15 May 2007 16:57 GMT
Dear Sirs
I have a Macro running perfect and it is executing the following:

- billyearlyhelpappendquery
- billhalfyearhelpappendquery
- billsappendquery
- openbillsappendquery
- Print report – billingcemetery
- billingtabledeletequeryquery

I would prefer to do this in VB. I did the following without success:

Private Sub cmdPrintbill_Click()
Dim stDocName As String

        stDocName = “billyearlyhelpappendquery”
        stDocName = “billhalfyearhelpappendquery”
        stDocName = “billsappendquery”
        stDocName = “openbillsappendquery”
        DoCmd.OpenReport “billingcemetery”, acViewNormal
        stDocName = “billingtabledeletequeryquery”

End Sub

I do not get any error message neither is anything shown if I Debug-Compile.
Can anyone alter my VB code so that it is working?
Thanks
Klaus
Rick Brandt - 15 May 2007 17:13 GMT
> Dear Sirs
> I have a Macro running perfect and it is executing the following:
[quoted text clipped - 24 lines]
> Thanks
> Klaus

You are merely assigning the name of a query to a variable.  You are doing
nothing to make them run.  Try the following...

CurrentDB.Execute "billyearlyhelpappendquery", dbFailOnError
CurrentDB.Execute "billhalfyearhelpappendquery", dbFailOnError
CurrentDB.Execute "billsappendquery", dbFailOnError
CurrentDB.Execute "openbillsappendquery", dbFailOnError
DoCmd.OpenReport "billingcemetery", acViewNormal
CurrentDB.Execute "billingtabledeletequeryquery", dbFailOnError

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

 
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.