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

determine selected row in subform 1

Status
Not open for further replies.

Apollo13a

Technical User
Apr 27, 2003
277
US
Hello, How can I get the primary key of the row selected in a subform? I have a subform linked to my main form using a field called TicketNumber(not the primary key). My subform has fields as follows: tblReferralID(Primary Key), StartDate, Contractor, TermDate, TicketNumber,ReferralComplete(Yes/No). The subform is based on a different table than the main form(although they have relationship using TicketNumber) When a user selects a record in a combobox(main form) the subform displays all records where the ReferralComplete = No or false. I also have code to change the subform property of Data Entry to No so I can show all the open referrals. Then a user can enter a Term Date for a referral to close out the referral. I need to know which record the user has entered a Term Date for to do some other actions in the Db. My current code always returns the Primary Key first record in the subform. I guess I could do a Dlookup using TicketNumber, StartDate and Contractor but I would like to use the Primary Key field. Any suggestions?
Jim
 
In the BeforeUpdate event procedure of the subform:
If IsDate(Me![Term Date control])
MsgBox "tblReferralID = " & Me![tblReferralID control]
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top