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

click on button to display more details

Status
Not open for further replies.

teebird

Technical User
Dec 11, 2001
239
Hi Everyone

I have a form with a subform and I want to click on a button in a field and have another form pop up to display more information about the record clicked on.

I have tried this but is not displaying the record I clicked on.

My form is frmDeftMain
My subform is qryDeftMain
My more info form is frmMoreInfo

My primary key on frmDeftMain is FileID and it is the same for the subform and the more info form.

Many thanks in advance.
tee
 
Hi tee!

You didn't tell us the record sources of the different forms so I'm going to guess that form frmMoreInfo is based on a query, or table, with the same primary key as the recordsource for form frmDeptMain(If it isn't, it should be). That being the case then use the following code to open the detail information form:

Dim strCriteria As String

strCriteria = "PrimaryKeyField = " & Me!PrimaryKey
DoCmd.OpenForm "frmMoreInfo, , , strCriteria

Where PrimaryKeyField is the field name in the recordsource of frmMoreInfo and PrimaryKey is the field name in the recordsource of frmDeptMain. If the primary key is a string field then use:

strCriteria = "PrimaryKeyField = '" & Me!PrimaryKey & "'"

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top