Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Excel to control Access 1

Status
Not open for further replies.

newguy86

Technical User
May 19, 2008
226
US
Hello I have created a userform in Excel that controls other programs in order to process Commission Requests, and one of the programs is an Access Database. I am currently able to open the database but none of my commands run. Basically I am only wanting to run an Append Query and print 2 Reports. The Append Query updates the table with the new commission request information and the reports are sent to Accounting for processing. If you have any useful tips that would be greatly appreciated!

<CODE>
Dim strDocName(1) As QueryTable
Dim strRptName(1 To 2) As Report

strDB = strFilePath & "Travel Agent Commission.mdb"
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB

strDocName(1) = "Append Upload File to Commissions Table"
appAccess.DoCmd.OpenQuery strDocName(1)

strRptName(1) = "TRAVEL AGENT COMMISSION CHECK REQUEST FORM"
appAccess.DoCmd.OpenReport strRptName(1), acViewPreview
appAccess.DoCmd.PrintOut

strRptName(1) = "Travel Agent Commission Inquiry"
appAccess.DoCmd.OpenReport strRptName(1), acViewPreview
appAccess.DoCmd.PrintOut

appAccess.CloseCurrentDatabase
</CODE>

Travis
 
What about this ?
Code:
Dim strDocName As String
Dim strRptName As String
strDB = strFilePath & "Travel Agent Commission.mdb"
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strDB
appAccess.Visible = True 'To see any error ...
strDocName = "Append Upload File to Commissions Table"
appAccess.DoCmd.OpenQuery strDocName
DoEvents
strRptName = "TRAVEL AGENT COMMISSION CHECK REQUEST FORM"
appAccess.DoCmd.OpenReport strRptName, acViewNormal
DoEvents
strRptName = "Travel Agent Commission Inquiry"
appAccess.DoCmd.OpenReport strRptName, acViewNormal
DoEvents
appAccess.CloseCurrentDatabase
appAccess.Quit
Set appAccess = Nothing

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top