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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import in excel from access

Status
Not open for further replies.

Senjen

Programmer
Jul 14, 2000
23
US
my original goal was to export 2 queries to an excel workbook with two worksheets when a user enters an incorrect password 3 times. that has been a problem so i would like to be able to export to 2 seperate workbooks then, from access, import the first workbook into the 2nd workbook as a worksheet. any ideas. here is the start of my code:
Private Sub cmdPassword_Click()
If [txtPassword] = DLookup("[Password]", "tblPassword", "[Month]=Left(Date(),2)") Then
DoCmd.RunSQL "UPDATE tblPassword SET tblPassword.Confirmed = False WHERE (((tblPassword.Confirmed)=True));"
DoCmd.RunSQL "UPDATE tblPassword SET tblPassword.Confirmed = True WHERE (((tblPassword.Month)=Left(Date(),2)));"
DoCmd.Close
Call RunStartup
Exit Sub
Else
[txtError] = [txtError] + 1
If [txtError] = 4 Then
DoCmd.OpenQuery "qxprtExcel"
DoCmd.OpenQuery "qxprtExcelArch"
MsgBox "You have failed to Enter the proper password. Your data has been saved in the Microsoft Excel spreadsheets titled 'Sprdshtretn.xls' and 'SprdshtretnArch.xls'. Contact Senjen Software Solutions for further instructions"
DoCmd.OutputTo acOutputTable, "EXCEL EXPORT", acFormatXLS, "Sprdshtretn.xls"
DoCmd.OutputTo acOutputTable, "EXCEL EXPORT Arch", acFormatXLS, "SprdshtretnArch.xls", True
Else
MsgBox "Try Again"
[txtPassword] = Null
DoCmd.GoToControl "txtPassword"
End If
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top