Call record from another form

  • Thread starter Thread starter Antonio
  • Start date Start date
A

Antonio

Hello, everybody,
I am running Access 2000. I have a form in which I have a
subform which displays all the open trouble tickets. It
displays the TicketID, CompanyName, and DateCreated. When
I double-click on the company name, in the subform, I
would like to open the trouble ticket form and display the
record of the company I double-clicked on. It opens the
frmTroubleTicket form, but it displays the first open
trouble ticket, not the record of the company I double-
clicked on. Any suggestions?
The code I am using is:

Private Sub CompanyName_DblClick(Cancel As Integer)

DoCmd.OpenForm "frmTroubleTicket", _
WhereCondition:="CompanyName = """ & Me.CompanyName
& """"

DoCmd.Close acForm, "OpenTTs"
End Sub
..
 
In the where condition try using forms![parent form
name].companyname instead of Me.CompanyName
 
Try this code in the double click event of your company
name:
Private Sub CompanyName_DblClick(Cancel As Integer)
Dim varWhere As String
Dim varSearchText As String
varWhere = Me.CompanyName
varSearchText = "CompanyName=" & varWhere
DoCmd.OpenForm "frmTroubleTicket", acNormal,, varSearchText
End Sub

Note that if your CompanyName comes from a combo box
varWhere should be dimmed as Long as it would be an
integer.
-----Original Message-----
In the where condition try using forms![parent form
name].companyname instead of Me.CompanyName
-----Original Message-----
Hello, everybody,
I am running Access 2000. I have a form in which I have a
subform which displays all the open trouble tickets. It
displays the TicketID, CompanyName, and DateCreated. When
I double-click on the company name, in the subform, I
would like to open the trouble ticket form and display the
record of the company I double-clicked on. It opens the
frmTroubleTicket form, but it displays the first open
trouble ticket, not the record of the company I double-
clicked on. Any suggestions?
The code I am using is:

Private Sub CompanyName_DblClick(Cancel As Integer)

DoCmd.OpenForm "frmTroubleTicket", _
WhereCondition:="CompanyName = """ & Me.CompanyName
& """"

DoCmd.Close acForm, "OpenTTs"
End Sub
..


.
.
 
Back
Top