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

Linking to View Rec Form, but cannot edit record

Status
Not open for further replies.

buee04

Technical User
Jun 27, 2002
129
US
Hi!

I have a form, frmInputMain, that shows all of the data for a record and you can step through each record one by one. You can edit a record, or add a new one.

Then I have a search where the results are returned in the continuous form, frmSearchResults. On that form I have a button, cmdEdit, where when clicked, it links ContractNumber (primary key) of the select record to frmInputMain, for editing.

The linking is done with this code in the on click of cmdEdit (txtContract is the textbox for ContractNumber),

Dim CNum As String 'yes, it is a string
CNum = Me.txtContract

DoCmd.OpenForm "frmInputMain"
[Forms]![frmInputMain].txtContract = CNum

When clicked, frmInputMain's txtContract displays the linked ContractNumber, but does not show the rest of the data attached to that record. How do can I tell frmInputMain that I want to edit the record whose ContractNumber was passed, not just making txtContract equal ContractNumber?

I thank you in advance.

 
How do I do that? I tried me.recordset = CNum in frmSearchResults' cmdEdit's on click event but did not work.
 
This is the error that I get after my frmInputMain has ContractNumber as CNum and I try to edit it:

The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship...
 
Nm, I got it. I used docmd.findrecord cnum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top