Edit record from form

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

Guest

I have a project that has a several tables and forms with customer
information. I want to be able to double click a record from my search
subform (double click the customerID) and open it up for edit. Unfortunitly
I can get it to open up the table (Customers) with the record, but rather
then opening that particular record that I double clicked, it opens the very
first record. How can I open to that particular record. Below I have my
code for when double clicked.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Customers"
DoCmd.OpenForm stDocName, , , stLinkCriteria
thanks.
 
You didnt specified the filter, Try to write the following code
Change the customerId, the first one to the name of the field in the table,
and the second one to the name of the field in the form.

stLinkCriteria = "CustomerId = " & me.customerId ' If customer id number
stLinkCriteria = "CustomerId = '" & me.customerId & "'" ' If customer id
String
stDocName = "Customers"
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Back
Top