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

How to use a button to pass information

Status
Not open for further replies.
Jul 13, 2004
5
0
0
US
I have a form that uses a subform to pull information from my list of records. Once i get the results, i want to be able to hilight a record from the list and relay it to another form. I believe that i have to use either a macro in conjunction with some VB code, or perform some trick on the button's properties. What i'm asking is how do i carry a record from my subform to my following form using a button?
 
Hi

Use the On Click event of your Command Button.

DoCmd.OpenForm "YourNewFormNameHere",,,"[IDNo] = " & Me.txtYourRecordIDFieldHere

IDNo is the unique record number (Primary Key) of the record you want to open, and Me.txtYourRecordIDFieldHere is the field on your form that contains that number (assuming that IDNo is a numeric field)

HTH

Alan
 
How are ya chicknfeet . . . . .

Is the dependant (2nd form) bound/unboud?

Calvin.gif
See Ya! . . . . . .
 
chicknfeet

Objective said:
form that uses a subform to pull information from my list of records ... hilight a record from the list and relay it to another form

Assumptions...
- Subform displays records in a contineous format.
- Subform record includes the key to the new / target form record.

AccessAddict, aka alan is correct. The OpenForm method will work.

The way I approach this is to actually include the command button on the subform, perhaps a small icon to the left of the record. For example, contacts for a company are listed in the subform. The end user clicks on the command button to open up details for the contact.

If this is what you intend to do, and the assumptions are correct, you can actually use the wizard to do the work for you. "Form Operations" => "Open Form" => Select target form => "Open form and find specific data to display" => Choose link fields, usually primary / foreign key => Choose text or icon (show all pictures). ...Done like a dinner.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top