wind20mph
MS Access User Since 1996
- Local time
- Today, 19:30
- Joined
- Mar 5, 2013
- Messages
- 50
I have encountered PC Lockdown when I tried this onClick Code.
I am trying to post a data from MSAccess field into a specific cell in Excel. The Excel File is formatted already as document. It is submitted for Attendance records. But I couldn't find the problem and fix to automate it properly.
here is the code, hope somebody who has ample experience in excel-access automation could give a hand...
I am trying to post a data from MSAccess field into a specific cell in Excel. The Excel File is formatted already as document. It is submitted for Attendance records. But I couldn't find the problem and fix to automate it properly.
here is the code, hope somebody who has ample experience in excel-access automation could give a hand...
Code:
Private Sub cmdRequery_Click()
On Error GoTo Err_AttSum
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = True
.Workbooks.Open "\\SCDCNET\ASP\Att.xls"
.Sheets("Att").Select
End With
xlApp.Range("C,5").Value = Me.EmpNo
xlApp.Range("D,5").Value = Me.EmpName
xlApp.Range("D,6").Value = Me.PayrollPeriod
xlApp.Range("E,7").Value = Me.PayrollCutOff
xlApp.Range("A,44").Value = Me.Remarks1
xlApp.Range("A,45").Value = Me.Remarks2
xlApp.Range("A,46").Value = Me.Remarks3
xlApp.Range("A,47").Value = Me.Remarks4
xlApp.DisplayAlerts = False
xlApp.ActiveWorkbook.Save
xlApp.ActiveWorkbook.Close
xlApp.DisplayAlerts = True
xlApp.ActiveWorkbook = Nothing
Exit_AttSum:
Exit Sub
Err_AttSum:
MsgBox Err.Description, vbInformation + vbOKOnly, "Error Attendance"
Resume Exit_AttSum
End Sub