Form On_Click Event

D

Dave_C

I am trying to streamline my VBA code and have created a new Sub Routine that
will handle many of the same requests with one parameter input.

My problem is that the process referenced is processed (2) times. I have auto
repeat set to NO.

Why is it processing the event (2) times?

I have it coded as follows for the On Click Event

=Designers_Reporting("1.08").

I KNOW THAT IF YOU HAVE A PROCESS FOR BOTH THE ON CLICK AND DOUBLE CLICK THE
CLICK ==> DOUBLE CLICK ==> CLICK WILL PROCESS.

Thaks for your help
 
M

missinglinq via AccessMonster.com

Perhaps we could see the entire On Click sub. =Designers_Reporting("1.08") by
itself makes no sense whatsoever!
 
D

Dave_C via AccessMonster.com

missinglinq said:
Perhaps we could see the entire On Click sub. =Designers_Reporting("1.08") by
itself makes no sense whatsoever!
Sorry it took so long but I found a work around to the situation but I am
still interestd in why the event processes twice.

My work around was to use the OnClick event to call Designers_Reporting.

Private Sub DesignerAccessAll_Click()
Designers_Sculptors_Reporting ("1.01")
End Sub

This works. I knew it would but I am always looking to stream line and move
to a total object system.

The sub in question is as follows. It is just a large case statement used to
do some pre-processing but it runs twice. It was being called from the
OnClick event directly.

Public Sub Designers_Sculptors_Reporting(ReportingType As String)

On Error GoTo Err_

If MsgBox("Do you want to create this report", vbYesNo) = vbYes Then
Select Case ReportingType
Case 1.01
If MsgBox("Do you want to use the default ALL Int/Ext
Designer Disciplines and ALL Programs??", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Designer", "Interior"
SelectDisciplinesForReport "Designer", "Exterior"
Select_HPVO_SVA_ForReport
End If
Case 1.02, 1.04, 1.06, 1.08
If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Interior Designers) ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Designer", "Interior"
End If
Case 1.03, 1.05, 1.07, 1.09
If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Exterior Designers) ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Designer", "Exterior"
Select_HPVO_SVA_ForReport
End If
Case 2.01
If MsgBox("Did you selecet the correct Disciplines and
Programs from above?", vbYesNo) = vbYes Then
MsgBox "This process will take 5 - 8 minutes. DO NOTHING
untill prompted to do so !!"

If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Interior and Exterior Designers and HPVO)
ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Designer", "Interior"
SelectDisciplinesForReport "Designer", "Exterior"
Select_HPVO_SVA_ForReport
End If
End If
Case 2.02
If MsgBox("This will create several EXCEL files in c:\data
and will take 5 - 8 minutes." & Chr(10) & _
"The screen will lock-up untill completed and all
files are saved." & Chr(10) & _
"Do you want to continue?", vbYesNo) = vbYes Then

If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Interior Designers) ONLY", vbYesNo) = vbYes
Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Designer", "Interior"
End If

MsgBox "This process will take 5 - 8 minutes. DO NOTHING
untill prompted to do so !!"
Process_Designer_Sculptor_DemandvsCapacityData 2.02
End If
Case 2.03
If MsgBox("This will create several EXCEL files in c:\data
and will take 5 - 8 minutes." & Chr(10) & _
"The screen will lock-up untill completed and all
fiels are saved." & Chr(10) & _
"Do you want to continue?", vbYesNo) = vbYes Then

If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Exterior Designers) ONLY", vbYesNo) = vbYes
Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Designer", "Exterior"
Select_HPVO_SVA_ForReport
End If
End If
Case 3.01
If MsgBox("Do you want to use the default ALL Int/Ext
Sculptor Disciplines and ALL Programs??", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Sculptor", "Interior"
SelectDisciplinesForReport "Sculptor", "Exterior"
End If
Case 3.02, 3.04, 3.08
If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Interior Sculptors) ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Sculptor", "Interior"
End If
Case 3.03, 3.05, 3.09
If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Exterior Sculptors) ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Sculptor", "Exterior"
End If
Case 4.01
If MsgBox("Did you selecet the correct Disciplines and
Programs from above?", vbYesNo) = vbYes Then
MsgBox "This process will take 5 - 8 minutes. DO NOTHING
untill prompted to do so !!"

If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Interior and Exterior Sculptors and HPVO)
ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Sculptor", "Interior"
SelectDisciplinesForReport "Sculptor", "Exterior"
End If
End If
Case 4.02
If MsgBox("This will create several EXCEL files in c:\data
and will take 5 - 8 minutes." & Chr(10) & _
"The screen will lock-up untill completed and all
files are saved." & Chr(10) & _
"Do you want to continue?", vbYesNo) = vbYes Then

If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Interior Sculptors) ONLY", vbYesNo) = vbYes
Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Sculptor", "Interior"
End If

MsgBox "This process will take 5 - 8 minutes. DO NOTHING
untill prompted to do so !!"
End If
Case 4.03
If MsgBox("This will create several EXCEL files in c:\data and
will take 5 - 8 minutes." & Chr(10) & _
"The screen will lock-up untill completed and all fiels
are saved." & Chr(10) & _
"Do you want to continue?", vbYesNo) = vbYes Then

If MsgBox("Do you want to use the default Discipline
Selection.??" & Chr(10) & _
"(Exterior Sculptors) ONLY", vbYesNo) = vbYes Then
SelectAllProgramsForReports
DeSelectAllDisciplines
SelectDisciplinesForReport "Sculptor", "Exterior"
End If
End If

Case Else
MsgBox "Houston We Have A Problem"
End Select

Process_Designer_Sculptor_DemandvsCapacityData ReportingType
Else
MsgBox "Report creation canceled by user."
End If

Exit_:
Exit Sub

Err_:
MsgBox Err & " " & Error$
Resume Exit_

End Sub
 
Top