Re: Tracking Use of Reports



To use Execute instead of RunSQL or OpenQuery, you need to concatenate the
values into the string, e.g.:

strSql = "INSERT INTO ReportUsage ( UsageID, ReportName, ReportFilter1,
ReportFilter2, ReportDateTime, ReportUser ) SELECT """ & Me.[UsageID] & """
AS Expr1, """ & Me.[ReportName] & """ AS Expr2, ...

More info:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"naigy via AccessMonster.com" <u17625@uwe> wrote in message
news:65af9cb71a8f0@xxxxxx
Possibly an easier question. I have got that query to work properly now
but
only when the Docmd.OpenQuery command is used. Is there a way to surpress
confirmation prompting without changing the global setting in access or
the
database or is this a bad idea. Many Thanks.


naigy wrote:
Thanks Allen. I have followed your example from what I can see but I have
a
few problems. Firstly here is my OpenReport Click code.

Private Sub Openrpt_Click()
DoCmd.OpenReport Me.RptList.Value, acViewPreview

Dim strSql As String
strSql = "INSERT INTO ReportUsage ( UsageID, ReportName, ReportFilter1,
ReportFilter2, ReportDateTime, ReportUser ) SELECT [UsageID] AS Expr1,
[ReportName] AS Expr2, [ReportFilter1] AS Expr3, [ReportFilter2] AS Expr4,
[ReportDateTime] AS Expr5, [ReportUser] AS Expr6;"
DBEngine(0)(0).Execute strSql, dbFailOnError

End Sub

Now when I run this I get a Runtime 3061 error and it says "Too few
parameters. Expected 6". I was wondering where in the append / sql code I
input what I want the values to be. Ie Me.RptList.Value for ReportName &
ReportFilter1 as Me.DateFrom.Value.

Thanks for your assistance to get to this stage.

So you have a form where the user selects the report they want, enters
any
criteria, and clicks a button to open the report, and you want to log
this.
[quoted text clipped - 34 lines]
(not
new records) also with a similar format.


.