Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify source calling Module

Status
Not open for further replies.

NRK

Technical User
Feb 13, 2002
116
US
I have a module that allows users to print data to a Word template. As a complication, this action needs to be called from two forms.

Normally, this wouldn't be an issue but users can further filter their selected data via an option group, which stores 2 radio buttons (1=Pass, 2=Fail).

My module works in the first form because I have an IF statement that calls it directly. Here is a code snippet from the module:
If [Forms]![CustFilter].[optgrpStatus] = 2 Then
strSQL = "SELECT qryWordReport.tcID AS ID, qryWordReport.tcDescription AS Description, " & _
"qryWordReport.TestObjective AS [Test Objective], qryWordReport.CompletionCriteria AS [Completion Criteria], " & _
"qryWordReport.ProductRequirement As [Product Requirement] " & _
"FROM qryWordReport"
ElseIf [Forms]![CustFilter].[optgrpStatus] = 1 Then
'returns TCs that have a 'Pass' status
strSQL = "SELECT qryWordReport.tcID AS ID, qryWordReport.tcDescription AS Description, " & _
"qryWordReport.TestObjective AS [Test Objective], qryWordReport.CompletionCriteria AS [Completion Criteria], " & _
"qryWordReport.ProductRequirement As [Product Requirement] " & _
"FROM qryWordReport " & _
"WHERE qryWordReport.tcStatus = 1"
End If


My problem is that the second form ([CustFilter_Print]) also needs to call this module and needs to use a similar statement to determine what option is set to True within the option group. Both forms call the Module with the following:
Call PrintCustReportWithWord


Is there some way to identify which Form is calling the module? If so, that would simplify my process... Or is there some other solution that I am overlooking?

Any help, as always, would be greatly appreciated.
 
Add an arg to the procedure:

Sub MyProcedure (CallerId as String)


If (CallerId = "CustFilter") Then
Do 'CustId Form Stuff
Loop '?
Else
Do 'Other Form Stuff
Loop '
End If


MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top