Solved

double click name open a record

Posted on 2014-02-11
8
461 Views
Last Modified: 2014-02-19
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
Comment
Question by:lehi52
  • 4
  • 2
  • 2
8 Comments
 
LVL 35

Expert Comment

by:PatHartman
ID: 39851493
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
 

Author Comment

by:lehi52
ID: 39851536
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
 
LVL 35

Expert Comment

by:PatHartman
ID: 39851567
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:lehi52
ID: 39851732
Ill see if I can figure it out based on what you put.
0
 
LVL 10

Expert Comment

by:Gozreh
ID: 39853307
I added a search when you Double Click the police name.
3.accdb
0
 

Author Comment

by:lehi52
ID: 39853577
Gozreh,  is there a way to have it change tabs and do the search when you click the name.
0
 
LVL 10

Accepted Solution

by:
Gozreh earned 500 total points
ID: 39853608
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
 

Author Closing Comment

by:lehi52
ID: 39853634
Gozreh, as usual.   Your help is immense.  I added the code and it works great.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question