Wednesday, June 1, 2011

OpenArgs Tutorial

I've read about 50 posts regarding passing a value from one form to another.  I hope this helps to fellow IT's

Step 1:  Click or choose the event from FormA where this value passing will happened.
Sample Scenario:  I have list of peoples in a grid list.  And every row has corresponding Patients ID (unique) and once the user click it another form will open with Patient  Details.




Step2: Let's say you put it on "On Dbl Click" create a procedure and code is like this:

Private Sub MR_DblClick(Cancel As Integer)
DoCmd.OpenForm "frm_TriageUpdate", OpenArgs:=Me.MR

End Sub
Step3:  Go to you next form where it will show the next information.  From my example it will show the Patients Detail Information.  Click the form details and inside the property window select Event tab and put it on "On Current" and create event procedure and code is like this:

Private Sub Form_Current()
If Not IsNull(Me.OpenArgs) Then
Me.MR = Me.OpenArgs
End If

End Sub

No comments:

Post a Comment