Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double Click List to Open Record? 1

Status
Not open for further replies.

Maillme

Technical User
Mar 11, 2003
186
NL
Hi there,

I have a list box on a form - which is populated by the "title" field form my documents log table.

I woudl like to open up the relevanty document's form by double clicking on it's title from this list - can anyone tell me how to achieve this?

many thanks,
Neil
 
If one of the columns has the path, you can use that with FollowHyperlink, for example:

FollowHyperlink Me.lstList.Column(2)
 
HI Remou,

thanks for the reply - there is no column, it is the record (another form) that i want to open up....

here's my setup:

I have a document_log table - this has a field (title).

I have a form, and within this form is a list box. This list box has all the titles (records from my documents_log).

I want to be able to double click the relevant title in this list, and open up the main record for this title (record within document_log).

thanks,
Neil
 
In that case, use a Where statement with OpenForm:

DoCmd.Openform "NameOfForm",,,"Title='" & Me.lstList & "'"

Assuming title is a text field.
 
Hi Remou,

I tried adding that code:

Code:
DoCmd.OpenForm "frm_document_log", , , "Title='" & Me.doc_list & "'"

To my document list double click event - but it didn't work?

Do i need to include anything else?

many thanks,
Neil
 
In what way did it not work (error messages etc)?
 
Hi Remou,

It just doesn't react at all - no error or debugger prompt - rather strange....


thanks again,
Neil
 
Try adding a breakpoint. Also check that the event line in the property sheet shows [Event Procedure].
 
Hi There,

I have it sussed - code is:

Code:
Private Sub doc_list_DblClick(Cancel As Integer)
DoCmd.OpenForm "frm_document_log", , , "document_title='" & Me.doc_list & "'"
End Sub

But the bound column needs to be set as "2" :)

many thanks,
Neil
 
You can refer to the column, rather than changing the bound column. For example:

Code:
Private Sub doc_list_DblClick(Cancel As Integer)
DoCmd.OpenForm "frm_document_log", , , "document_title='" & Me.doc_list.Column(1) & "'"
End Sub

Note that, in this case, columns start numbering from zero.

If the listbox includes a unique ID, you could use that instead:

Code:
Private Sub doc_list_DblClick(Cancel As Integer)
DoCmd.OpenForm "frm_document_log", , , "Unique ID Field Name=" & Me.doc_list
End Sub

Assuming that the unique ID is numeric and that the bound column is the ID.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top