Using a subform to show newrecord on the main form

G

Greg

I have a main form used for entering a trouble ticket. On the main form there
is a search area with a subform which shows a summary of trouble tickets
that are still open. I'm trying to make it so that when the individual
double clicks on the ticket number of the subform, the main form goes to that
record. Ticket numbers are unique.

Dabased is shared by few users and I noticed that when different user
created a new ticket, after I click on this ticket in a subform it is not
showing on a form. I have to close form and reopen then eveything is ok.
here is the code:

Private Sub Form_DblClick(Cancel As Integer)
Parent.Recordset.FindFirst "[Ticket #]=" & Me.[Ticket #]
Forms![Remedy Tickets]![Status].SetFocus
End Sub
 
A

Arvin Meyer [MVP]

Closing a form then reopening to get current data usually means that either
the current record hasn't saved yet, or the form hasn't been requeried. Try
something like this (untested):

Private Sub Form_DblClick(Cancel As Integer)
Dim lngTicket As Long

lngTicket = Me.[Ticket #]
Me.Parent.Requery

Me.Parent.Recordset.FindFirst "[Ticket #]=" & lngTicket
Forms![Remedy Tickets]![Status].SetFocus
End Sub
 

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

Top