• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 479
  • Last Modified:

double click name open a record

I have a list of leads on Lead List tab on the Contact form.  I need to be able to click the row and bring up the record on the General tab.
1.accdb
0
lehi52
Asked:
lehi52
  • 4
  • 2
  • 2
1 Solution
 
PatHartmanCommented:
I can't download your database at the moment so I may be off target.

Assuming the the two forms are actually subforms on another form, change the RecordSource query of the form you want to control so that it references a control in the driving form.

Select ...
From ...
Where somefield = Forms!yourmainform!sfrm1.Form!keyField;

Then in the click event, requery the subform.
Me.Parent!sfrm1.Form.Requery

or the long form of reference would be
Forms!yorumainform!sfrm1.Form.Requery
0
 
lehi52Author Commented:
There is a subform called contact form1 with a list of names.  WHen you click a name it needs to load the record on a different tab.   I attached the database but zipped up. I am a beginner so the more simple you can make it the better.
2.accdb
0
 
PatHartmanCommented:
I can't load your database.  I am not in my office.  Can you try to modify the query to reference the form field that contains the foreign key you need to reference?  You only need the one line of code (the requery) in the click event to make this work.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
lehi52Author Commented:
Ill see if I can figure it out based on what you put.
0
 
GozrehCommented:
I added a search when you Double Click the police name.
3.accdb
0
 
lehi52Author Commented:
Gozreh,  is there a way to have it change tabs and do the search when you click the name.
0
 
GozrehCommented:
yes, add to the code    Me.Parent.TabCtl0 = 1
Private Sub Policy_Name_DblClick(Cancel As Integer)
   DoCmd.SearchForRecord acDataForm, "Contact Form", acFirst, "[ContactID] = " & Nz(Me.ContactID, 0)
   Me.Parent.TabCtl0 = 1
End Sub

Open in new window

0
 
lehi52Author Commented:
Gozreh, as usual.   Your help is immense.  I added the code and it works great.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now