I have some reports I need to run automatically every morning. The same reports can be run manually by clicking some buttons on a form. I was hoping I could, via vb, remotely manipulate the form. There are certainly other ways I can do this, but it seems like, for ease of maintenance, it would be nice if I could just pretend I was an automated remote user, and manipulate the form the same way a user would.
The code I'm using is shown below. It works OK except when I am running in on a Citrix terminal server, run-time environment. I get error #429, "ActiveX component can't create object". The terminal server has ONLY runtime access installed.
If I run it from my desktop, which of course has the full version of Access, it works fine...even if I use the \runtime command line option.
So... any ideas on how I might get this to work on the terminal server? Do you think this is a runtime issue, or a server issue, or what?
Using Access2002. Here's the code:
The code I'm using is shown below. It works OK except when I am running in on a Citrix terminal server, run-time environment. I get error #429, "ActiveX component can't create object". The terminal server has ONLY runtime access installed.
If I run it from my desktop, which of course has the full version of Access, it works fine...even if I use the \runtime command line option.
So... any ideas on how I might get this to work on the terminal server? Do you think this is a runtime issue, or a server issue, or what?
Using Access2002. Here's the code:
Function PrintAOIReports(lngShift As Long) As Boolean
Dim DB As DAO.Database, appAccess As Access.Application
Dim Ctl As Control, i As Long
If errorhandlingon Then On Error GoTo ErrHandle
PrintAOIReports = False
Set appAccess = CreateObject("Access.Application")
'appAccess.Visible = False 'doesn't seem to work here;when you open the db it resets to true
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase pcainternal_fe
appAccess.Visible = False
With appAccess.Forms("PCAINternalswitchboard")
!hardcopy = True
Select Case lngShift
Case 1, 2
!startpareto = Date
Case 3
!startpareto = Date - 1
End Select
!stoppareto = Now()
!reporttype = 1
!Noun.Enabled = False
!PartNumberToggle = 0
!PartNumber.Enabled = False
!RefDesToggle = 0
!RefDes.Enabled = False
!RepCodeToggle = 0
!RepCode.Enabled = False
!inspectpoint.Enabled = True
!InspChoice.Value = 3
Set Ctl = .Controls("inspectpoint")
For i = 0 To Ctl.ListCount - 1
If Left(Ctl.ItemData(i), 3) = "AOI" Then Ctl.Selected(i) = True
Next i
!RespChoice.Value = 3
!Value.Enabled = True
!Value.Value = "SMT"
!DivisionToggle = 0
!Division.Enabled = False
!row.Value = "[attributeyields].[noun] & '_A' & [Assyno] & [RefDes]"
!Column.Value = "attributerepairs.repcode"
!limit.Value = 10
.gomaster "ParetoPCAInternal_Default", "evtews3" '"EVTEWS3"
'.gopareto_click ' note that to make this work,you must set the click event to PUBLIC!
'!gopareto.SetFocus 'setfocus and sendkeys work without making public
'SendKeys "{ENTER}"
End With
LogError "AOI Report for Shift " & lngShift, "PrintAOIReports"
GoTo CloseAll
ErrHandle:
LogError Err.Description, "PrintAOIReports", Err.Number
CloseAll:
appAccess.Quit
Set appAccess = Nothing
End Function