Question : How to order this sequence of events

As seen in
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_24479396.html?cid=239
I got a solution that works very well independently of one another...but I run into a Catch-22 now that I have the code all together and working....

I need to set the tag of the form i'm opening after it opens....
I also need this tag to be set before the form opens so that I can use the proper SQL statement

How can I arange this to all work well together?

Answer : How to order this sequence of events

You could do something from the opening form like:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Private Sub OpenfrmGetDate_Click()
    Dim stDocName As String
    DIM SQL as String
 
    SQL = "SELECT Field1, Field2, Field3, .... " & _
    "FROM MyTable " & _
    "WHERE Left(CustName,3) = '" & Left(Forms!frmMarketing!CustFld, 3) & "' " & _
            "DEPT = 'Marketing'"
 
    stDocName = "frmGetDate"  '<-- Form name to open
    DoCmd.OpenForm stDocName  'Open the form 
    Forms![frmGetDate]!RecorodSouce = SQL 
    Forms![frmGetDate].Tag = "frmMarketing" '<-- Put the Tag on to show the _
                                originating form.
 
End Sub
Open in New Window Select All
Random Solutions  
 
programming4us programming4us