Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

report code

0 views
Skip to first unread message

buddy

unread,
Dec 29, 2009, 7:21:02 AM12/29/09
to
can anyone help me with the code below, i cannot use the command to generate
reports twice, it only displays once. is anything wrong with the code?

Dim mygen As Recordset
Dim cab As ADODB.Connection
Set cab = New ADODB.Connection
Set mygen = New Recordset
cab.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=
C:\accesss\abtab.mdb;"
cab.Open
qry = "INSERT INTO tabrep ([ddate], ab_user, comp_name, ab_compl, ab_issue,
ab_sol, ab_status, branche)"
qry = qry & " SELECT helpd.ddate, helpd.ab_User, helpd.Comp_name,
helpd.ab_Compl, helpd.ab_Issue, helpd.ab_Sol, helpd.ab_Status, helpd.branche"
qry = qry & " From helpd"
If chkall.Value = 1 Then
qry = qry & " WHERE (((helpd.ddate) Between #" & dtdate1 & "# And #" &
dtdate2 & "#));"
Else
If chkname.Value = 1 Then
qry = qry & "where (((helpd.ab_user)= '" & cmbname & "') AND
((helpd.ddate) Between #" & dtdate1 & "# And #" & dtdate2 & "#));"
Else
If chksts.Value = 1 Then
qry = qry & "where (((helpd.ab_status)= '" & cmbsts & "') AND
((helpd.ddate) Between #" & dtdate1 & "# And #" & dtdate2 & "#));"
Else
If chkbr.Value = 1 Then
qry = qry & "where (((helpd.branche)= '" & cmbbr & "') AND
((helpd.ddate) Between #" & dtdate1 & "# And #" & dtdate2 & "#));"
End If
End If
End If
End If
ty = "Delete * from tabrep"
cab.Execute ty
cab.Execute qry
cr.Connect = cab.ConnectionString
cr.ReportFileName = "C:\accesss\abn1.RPT"
cr.Action = 1

Richard Mueller [MVP]

unread,
Dec 29, 2009, 12:01:29 PM12/29/09
to

"buddy" <bu...@discussions.microsoft.com> wrote in message
news:4BA0F11F-E507-46E8...@microsoft.com...

First, the code is VB, not VBScript. Early binding and strong typing are not
allowed in VBScript (for example "Dim cab As ADODB.Connection" and "Set cab
= New ADODB.Connection"). Next, the program seems to delete all rows from a
table in an Access database, then insert new rows based on a query of
another table. I don't see where a report is generated. Also, the reference
mygen is never used, and we cannot tell what variable cr refers to. It seems
to be an object I'm not familiar with. And we don't know what many of the
variables are, such as chkall, chkname, etc. I would guess that you expect
the object cr to generate a report, but I don't see how.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


buddy

unread,
Jan 6, 2010, 10:23:01 AM1/6/10
to
hi richard, can u help me with a sample report generation code. thanx for the
help

"Richard Mueller [MVP]" wrote:

> .
>

0 new messages