Form shows 1st record instead of selected record

MD12

Registered User.
Local time
Tomorrow, 02:56
Joined
May 8, 2014
Messages
10
Hi..i am new to this forum and access and I recently encountered a double click issue

My form loads perfectly on double click event but it shows the first record instead of selected record.

My search is based on a PersonID but each PersonID has different WorkID that I wish to display on double click but it always shows the first WorkID instead of my selected record

I have tried changing the filters in the form properties but it still doesn't work for me. Would appreciate some help on this. Thanks in advance

Here's my code:
Private Sub SearchResults_DblClick(Cancel As Integer)

DoCmd.OpenForm "WorkForm", , , "[PersonID]=" & Me.[Searchresults], , acNormal

End Sub

[Searchresults] draws information from my Query
Query information:
PersonID... WorkID... Type......Location
1234..........1............Paint .....Address A
1234..........2............Electric...Address B
1234..........3............Floor..... Address C
 
Of the three records which one do you want to show? As you can see all the result of the SearchResult has the same PersonID.
 
Try something like this:

Code:
Function ClientsInterestClient()
    With CodeContextObject
            DoCmd.OpenForm "Clients Interest Enquiry", acNormal, "", ClientsFilter, acFormEdit, acWindowNormal
            DoCmd.GoToRecord acDataForm, "Clients Interest Enquiry", acGoTo, .CurrentRecord
    End With
End Function

The ClientFilter applied the same filter as the first form.

Simon
 
of the 3 records. say I wish to click on the row with WorkID 2 and show up in a second form that I have with WorkID 2 details. it keeps showing the details of WorkID 1 whenever I double click on either WorkID 2 or 3
 
My example works for any record, providing that is, the query and form Order is the same.

You simply can't Double-click a record in one form and not tell the next form which record you are looking for. If it is a single record, when opening the second form you to create a filter with the WorkID reference from the initial form.

Simon
 
Then use the Unique Id to open the record, Try this code,
Code:
Private Sub SearchResults_DblClick(Cancel As Integer)
    DoCmd.OpenForm "WorkForm", , , "[WorkID]=" & Me.[Searchresults].Column(1), , acNormal
End Sub
 
Thanks everyone. it's working fine for me now after following your codes!
 

Users who are viewing this thread

Back
Top Bottom