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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ON Click display record problem

Status
Not open for further replies.

cmonthetic

IS-IT--Management
Oct 18, 2004
27
GB
Hi,

I have a database that runs a query from selected user input and displays the results of the query in datasheet view, when the user clicks on a record in datasheet view I am trying to get the record that is clicked on to be displayed in a form.

I have got the form displaying but it just displays all of the records that fit the original query parameters where I just need the record that the On Click event is started on to be displayed.

Any suggestions!!!!

TIA

 
you can't use a query to specify a particular record, at least not in the way you want...

however if you use a Listbox to display the results, then if you click on a result, the listbox can be bound to that record, and then you can use a unique value(s) in that record to specify the criteria for the form...

--------------------
Procrastinate Now!
 
There are a couple ways you could do this, but from what I understand as you've described it, the record source of your resulting form isn't specific enough. If you are getting a form to display from an event, then you should be able to retrieve those key values of the current record clicked on.

If you have those values, you can either dynamically build an SQL statement or create a query with those key values in your WHERE clause. Use that as your Record Source for the resulting form. This can be done either when the record is clicked or in the form open or load event of the resulting form.

... or if you're using the DoCmd.OpenForm, you can set your record source criteria for the form in that command when opening it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top