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
Private Sub cmdPassword_Click()
If [txtPassword] = DLookup("[Password]", "tblPassword", "[Month]=Left(Date(),2)"
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