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

Open new form and show record selected in "previous" subform

Status
Not open for further replies.

kermit01de

Technical User
Jan 20, 2002
256
DE
After browsing around and testing several things, I am not really coming to the final ...

Having a from containing a subform "frmSUB".

What I would like to have:
Click on the "Name" field in the subform should open a new Form "frm_DispDetail", displaying the details of the selected record.

Any hint available?

What I tried - but this does not work:

Private Sub User_Click()
DoCmd.OpenForm "frm_DispDetail", , , , , acDialog
Dim rs As dao.Recordset
Set rs = Me.frm_DispDetail.Recordset
rs.FindFirst "User = " & Me.User
End Sub

Any hint available?

Mirko

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Look at the docmd.openform

Example
Code:
Private Sub cmdOpenSales_Click()
  Dim sWHERE As String

  'Comment out or delete the line that does not apply --
  ''If the ID is a number, built the WHERE clause like this:
  sWHERE = "[CustomerID] = " & Me.CustomerID
  ''If the ID is a text value, you need to surround the ID in single quotes
  sWHERE = "[CustomerID] = '" & Me.CustomerID & "'"

  'Open the form
  DoCmd.OpenForm "frmSales", acNormal, , sWHERE
End Sub
 
Replace this:
DoCmd.OpenForm "frm_DispDetail", , , , , acDialog
with this:
DoCmd.OpenForm "frm_DispDetail", , , "[User]='" & Me!User & "'", , acDialog

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you!

--------------------------------------
>>>>>> Bugs will appear in one part of a working program when another 'unrelated' part is modified <<<<<
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top