Open record from search form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a search form that brings up multiple records or single records
depending on the criteria in a datasheet voew. Is there a way to be able to
click on the record you need and open that record in the form view?
Thanks in advance!!
 
Add some code to the DblClick event procedure of the appropriate text box in
your search form.

This example opens a form named frmClient to the record with the matching
ClientID value:
Dim strWhere As String
strWhere = "[ClientID] = " & Me.ClientID
DoCmd.OpenForm "frmClient", WhereCondition:=strWhere

Notes:
1. If ClientID is a Text field (not a Number field), you need extra quotes:
strWhere = "[ClientID] = """ & Me.ClientID & """"

2. If frmClient is already open, this won't work.
 

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

Back
Top