Continuous Button click (1 Viewer)

rio

Registered User.
Local time
Today, 10:12
Joined
Jun 3, 2008
Messages
124
Hi.
this is my button code :
Code:
Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
    Dim stDocName As String

    stDocName = "rptPthAsas"
    stLinkCriteria = "[StnName]=" & "'" & Me![StnName] & "'"
    DoCmd.GoToRecord , , acNext
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    DoCmd.Close
Exit_Command1_Click:
    Exit Sub

Err_Command1_Click:
    DoCmd.Close , Form3
    
End Sub

I make it auto click when open the form:

Code:
Private Sub Form_Open(Cancel As Integer)
Command1_Click
End Sub

so...how to make this auto click continues until no more record (StnName)
 

SOS

Registered Lunatic
Local time
Yesterday, 19:12
Joined
Aug 27, 2008
Messages
3,517
Why? Why is this doing it anyway. Why open the report just to close it? What is the point?
 

rio

Registered User.
Local time
Today, 10:12
Joined
Jun 3, 2008
Messages
124
actually... i don't know how to used loop.
i want to save all my graph in jpeg. you can can see my problem here http://www.access-programmers.co.uk/forums/showthread.php?t=189421.

so then i make hard way. After closed the report the graph will be save. that all i can do. i take a few week to solve the problem. then i come out with this.
Code:
Private Sub Report_Deactivate()
Dim oleGrf As Object
Dim strDate As String
Dim strFolder As String
Dim sts As String

sts = Me!StnName
strDate = Format(Now(), "dd mmmm yyyy")
strFolder = "StnInfo" & " (" & strDate & ")"
If Len(Dir((CurrentProject.Path & "\" & strFolder), vbDirectory)) = 0 Then
    MkDir (CurrentProject.Path & "\" & strFolder)
    End If
Set oleGrf = Me.Graph5.Object
oleGrf.Export Filename:=(CurrentProject.Path & "\" & strFolder) & "\" & "Graph (" & sts & ")" & ".jpg"
hopefully you can give any suggestion.
 

Users who are viewing this thread

Top Bottom