how to refer to Controls in Selected Report thru VBA Platform (1 Viewer)

sumox

Registered User.
Local time
Today, 13:43
Joined
Oct 1, 2013
Messages
89
i have created a module under module section of my DB
My Report Name : "PURCH VB Query"

the code is as follows :
(what is want tell you later..)
Code:
Sub Erlick()
DoCmd.SelectObject acReport, "PURCH VB Query", True
 
 
'"PURCH VB Query", acViewPreview, "PURCH VB Query"
For i = 1 To 3
DoCmd.PrintOut acPrintAll, , , , i
Next i
 
'This is for creating Seperate Text Per Copy in RptHeader Preview
End Sub

i've placed a TextBox in my report named Text25 to the value :
=+1
properties-->data-->running sum--> Set to OVer all

i've also set a textbox in my report named CpyWord to the value :
=IIf([Text25]=1,"Original Buyer Copy", IIf([Text25]=2,"Duplicate File copy",))

Now what is want is Three Copies of Report with Two copies
marked seperately as per above IIF statement

Please help me out guys. As i want Three Copies with each Rpt-header
as Different Text

Possible solutions (ba donna no a script)
How do i refer to Report's control after Docmd.SelectObj....
if any facility then i can do easily thru the dazzling for next loop
How do i increase Report's control Text25's value, if three copies r there
I know there are many events in Report

I've stucked over this point. My all App in db is ready
I've searched all google. ba i think here in the heaven of Access
i shall find my true sol.
 

Fuse3k

Registered User.
Local time
Today, 04:13
Joined
Oct 24, 2007
Messages
74
Why not create a new blank report and add your "PURCH VB Query" report as two subforms to it? Above each subform control you can add a label for "Original Buyer Copy" and "Duplicate File Copy"

Then just print that "Master" Report in triplicate.
 

sumox

Registered User.
Local time
Today, 13:43
Joined
Oct 1, 2013
Messages
89
OK BUT ,
FOR THIS
I'VE TO INSERT THREE COPIES OF SAME REPORT"PURCH VB Query" in Detail Section
and set a txtboxnum to "=+1" and set the IIF functions to detect and process
conversion from number to Words i.e if 1, text= "Original Copy"

will it be good forever ???

for multiuse F.E/B.E Purpose??

please give ur opinion
 

Fuse3k

Registered User.
Local time
Today, 04:13
Joined
Oct 24, 2007
Messages
74
I would have thought my solution would eliminate your need for the counting textbox. Since each report is its own subform, you could just put a static label above each one. Perhaps I don't fully understand what you're trying to do there.

In any case, multiuser FE/BE should not be a problem.
 

sumox

Registered User.
Local time
Today, 13:43
Joined
Oct 1, 2013
Messages
89
ok , so i shud create a new blank report.

under detail section.

just create three subreports pointing to -->"Purch Vb Query"

and then Create a static Label above each of these

is this what i copy ? or your solution ?
 

JHB

Have been here a while
Local time
Today, 10:13
Joined
Jun 17, 2012
Messages
7,732
Use the report's open argument on the form's "On Load" event, to set the text in "CpyWord".

Code:
  Dim i As Integer, TheOpenArgument As String
  
  For i = 1 To 3
    If i = 1 Then
      TheOpenArgument = "Original Buyer Copy"
    ElseIf i = 2 Then
      TheOpenArgument = "Duplicate File copy1"
    Else
      TheOpenArgument = "Duplicate File copy2"
    End If
    DoCmd.OpenReport "PURCH VB Query", acViewPreview, , , , TheOpenArgument
    DoCmd.Close acReport, "PURCH VB Query"
  Next i
Code:
Private Sub Report_Load()
  Me.CpyWord = Me.OpenArgs
End Sub
 

sumox

Registered User.
Local time
Today, 13:43
Joined
Oct 1, 2013
Messages
89
OK . so where does the Dim... Code goes
in Textbox Event(CpyWord) where in wordtext shall be shown ??

i am not expert in Vba .

Pls. keep me in your guidance .

but meanwhile before you reply, i am trying.

thanks to you if got success
ElseIf
Pls. see the errors in my next post

Pls. do visit this post ! keep watching... until solved
 

sumox

Registered User.
Local time
Today, 13:43
Joined
Oct 1, 2013
Messages
89
Dear JHB
Error :

Not working ! just do nothingg ! at all

created form ---> Onload dumped the Dim... script

Created PvtSub_RptLoad vba func as per advice,

but no result. Nothinggg
 

JHB

Have been here a while
Local time
Today, 10:13
Joined
Jun 17, 2012
Messages
7,732
I've made some sample for you, open the only form in the attached database, and click the button.
 

Attachments

  • PURCH VB Query.mdb
    348 KB · Views: 82

sumox

Registered User.
Local time
Today, 13:43
Joined
Oct 1, 2013
Messages
89
ok .

it's showing like attached screenshot.

It's not populating the Report's textbox

wud cmpt-n-repair will do the job?

many thanks in advance

Ya'its opening same report three times with different dialogboxes text -- which i donnna want .

?? Another solution whether query design can be changed to
Triplicate Data ?
 

Attachments

  • DESKCAM_ALS_20140605_rtAccessReport.jpg
    DESKCAM_ALS_20140605_rtAccessReport.jpg
    114.4 KB · Views: 95

JHB

Have been here a while
Local time
Today, 10:13
Joined
Jun 17, 2012
Messages
7,732
I can't tell you what happen by you, I can only show you how it looks like by me.
 

Attachments

  • Rep.jpg
    Rep.jpg
    28.2 KB · Views: 145

Users who are viewing this thread

Top Bottom