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

Want to use DoCmd to bring up correct record

Status
Not open for further replies.

hals

IS-IT--Management
Feb 11, 2004
6
DE
I have two tables: STUDENT with primary key Student ID, and ALUMNI with primary key Alumni ID. They have a 1-to-1 relationship, Student ID is AutoNumber (system generated number), and Alumni ID is a Number of type Long Integer. When working in the STUDENT form, I have created a button called, View/Update Alumni. When I click on this button it asks for the Student ID number, and when I enter the Student ID, the correct Alumni record comes up. I am using the code:

DoCmd.OpenForm "ALUMNI", , , "[Alumni ID] = [Student ID]"

Is there a way for the DoCmd to bring up the correct Alumni record without requiring the user to enter the Student ID?

Thank you for any help,
Hal S.
 
Create an hidden textbox in with the controlsource Student ID With the name Student

Edit the line to:
DoCmd.OpenForm "ALUMNI",,,"[Alumni ID] = " Student.Value
 
When the student is display Store the key in a variable global to the form.

Rayman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top