Opening record based on primary key

AlexB

Registered User.
Local time
Today, 22:08
Joined
Mar 3, 2003
Messages
21
How do I open a record on the primary key, rather than having to open it on the row number using the docmd.gotorecord command??

On another note, how would I go about interacting with a query using code? Is it in the SET RST command?

Thanks...


:confused: :confused: :confused: :confused: :eek:
 
Alex,

Make a "bound" form based on your table.

Make a query that includes the fields that you
want on your form.

Then add a new field "txtSearch" with no control
source and a default value of "*".

Modify your query so that the criteria for the
Primary key field is:

Like "*" & Forms![YourForm]![txtSearch] & "*"

In the AfterUpdate event of "txtSearch" put
Me.Requery

Experiment with it.

I don't know what you mean "interact with a
query using code".

Wayne
 
If you needed to restrict the query to a specific row or set of rows, you would use criteria in the where clause.
 

Users who are viewing this thread

Back
Top Bottom