Load event - multiple criteria

M

Mary

I have the code below that is working to load form "OA_home" with the value
from the ID field on form "MyEvents" if that form is open. A user can
double-click a ticket number and it will take them to the OA_home form to
that record where they can make updates. I'd like the same setup if form
"Events" is loaded. Can the code below be updated to reference that form as
well? There should not be a case when both Events and MyEvents are open.

Private Sub Form_Load()
If CurrentProject.AllForms("MyEvents").IsLoaded Then
Me.Combo1 = Forms!MyEvents!ID
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo1], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me.Date_of_Event.Visible = True
Me.Date_Submitted.Visible = True
Me.Time_of_Impact.Visible = True
Me.Time_of_Restoration.Visible = True
Else: DoCmd.GoToControl "combo1"
End If

End Sub


Thank you!
Mary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top