Senin, 04 Maret 2013

RE: [MS_AccessPros] On Format Event in Report Repeats twice (MS2010)

 

Norbert-

When you're at the bottom of a page, and the next detail section won't fit,
you'll get events in this sequence:

Format

Retreat

Format

Print

Why not do this in the Print event that fires only once for each detail
section?

Also, why not define the database and recordset at the module level and open
the recordset in the Load event? And it's more efficient if you do:

Set rstRS = dbsDB.OpenRecordset(strSQL, dbOpenDynaset, dbAppendOnly)

. since you're only adding records.

John Viescas, Author

Microsoft Access 2010 Inside Out

Microsoft Access 2007 Inside Out

Microsoft Access 2003 Inside Out

Building Microsoft Access Applications

SQL Queries for Mere Mortals

http://www.viescas.com/

(Paris, France)

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of
drnorbert@msn.com
Sent: Monday, March 04, 2013 2:05 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] On Format Event in Report Repeats twice (MS2010)

Why the event On Format in a Report is duplicating?

I would like to add code to populate a table inside the ON Format Event such
as for ex:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim rstRS As Recordset
Dim strSQL As String
Dim dbsDB As Database

Set dbsDB = CurrentDb

strSQL = "SELECT * FROM tblSixYrHold"
Set rstRS = dbsDB.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)

With rstRS
.AddNew
!MseqNo=me.MasterFileNo
.Update
.Close
End With

Set dbsDB = Nothing

End Sub

Perhaps I could insert an Static counter to avoid duplication when the
record is inserted in the recordset.....

Thanks a lot
Norbert

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar