Ok, i'm having a bit of trouble with the following code. What i want it
to do is open a runtime access window with the report in it and maximise
the window and set focus on it (already asked that question earlier but no-
one could give me an answer) and if another report is called open it in a
new window. At the moment it opens the report and maximises the report,
but doesn't set focus or maximise the access window and if you open
another report it just opens a new window and then opens the report in the
first window. I just end up with blank access windows and all the reports
in the first window opened. At the moment the only solution i can think
of is to check if there is a report open and bypass the shell part and
have all the reports in one window but i don't really want that.
Any ideas?
Oh, and does anyone know how to disable check boxes but keep the
background bit white and not grey? I've tried all the colour properties i
could see.
Function OLEOpenReportRuntime(strDBName As String, _
strRptName As String, _
Optional ByVal intDisplay As Variant, _
Optional ByVal strFilter As Variant, _
Optional ByVal strWhere As Variant _
) As Boolean
On Error GoTo OLEOpenReportRuntime_Err
Dim x As Long
Dim objAccess As access.Application 'Object
x = Shell("c:\program files\microsoft office\Office\msaccess.exe " & _
Chr$(34) & strDBName & Chr$(34) & " /nostartup /user " & Chr$(34)
& UserID & Chr$(34) & " /pwd " & UserPwd & _
"/Runtime /Wrkgrp " & Chr$(34) & _
"c:\my documents\cateq\catering.mdw" & Chr$(34))
Set objAccess = GetObject(strDBName)
If IsMissing(intDisplay) Then intDisplay = acNormal
If IsMissing(strFilter) Then strFilter = ""
If IsMissing(strWhere) Then strWhere = ""
objAccess.DoCmd.OpenReport strRptName, intDisplay, strFilter, _
strWhere
objAccess.DoCmd.Maximize
Set objAccess = Nothing
OLEOpenReportRuntime = True
OLEOpenReportRuntime_End:
Exit Function
OLEOpenReportRuntime_Err:
MsgBox Error$(), vbInformation, "Automation"
Resume OLEOpenReportRuntime_End
End Function