I want to simplify some code and eliminate some hardcoding.
I use a seach form with many other forms. The other forms call up the search form, and then receive back data from the search form.
I store the name of the original "calling" form in the tag of the search form, and then use it to send data back to the originating form.
My current code works but is a little clunky, and has to be added to whenever I add new forms that will use the search form.
The relevant snippet of code in the search form is
Select Case Me.Tag
Case Is = "FrmA"
Forms!FrmA.Tag = LstWalk.Tag
Forms!FrmA.Requery
Case Is = "FrmB"
Forms!FrmB.Tag = LstWalk.Tag
Forms!FrmB.Requery
Case Is = "FrmC"
Forms!FrmC.Tag = LstWalk.Tag
Forms!FrmC.Requery
Etc....
End Select
That works but ....can I eliminate hardcoding the name of the originating forms over and over and let some variable do the work?
What I am hoping for in pseudocode:
SendingFormNameVariable.tag = LstWalk.Tag
SendingFormNameVariable.requery
Or something like that - just a couple of lines that "understand" where to point the information.
Thanks in advance!
C
I use a seach form with many other forms. The other forms call up the search form, and then receive back data from the search form.
I store the name of the original "calling" form in the tag of the search form, and then use it to send data back to the originating form.
My current code works but is a little clunky, and has to be added to whenever I add new forms that will use the search form.
The relevant snippet of code in the search form is
Select Case Me.Tag
Case Is = "FrmA"
Forms!FrmA.Tag = LstWalk.Tag
Forms!FrmA.Requery
Case Is = "FrmB"
Forms!FrmB.Tag = LstWalk.Tag
Forms!FrmB.Requery
Case Is = "FrmC"
Forms!FrmC.Tag = LstWalk.Tag
Forms!FrmC.Requery
Etc....
End Select
That works but ....can I eliminate hardcoding the name of the originating forms over and over and let some variable do the work?
What I am hoping for in pseudocode:
SendingFormNameVariable.tag = LstWalk.Tag
SendingFormNameVariable.requery
Or something like that - just a couple of lines that "understand" where to point the information.
Thanks in advance!
C