Open a form with maatching Record

  • Thread starter Thread starter KAnoe
  • Start date Start date
K

KAnoe

I have a Fm that shows all records. I wouls like it so
that when the user Dblclicks the SSN of a record it will
open a form that has the same SSN. Here is the code that
I'm using.


Private Sub ind_ssn_DblClick(Cancel As Integer)

Dim StDocName As String 'Fm that is going to
open
Dim StlinkCriteria As String 'Sets the Criteria of
the record to open in the above Fm

StDocName = "DEP_SSN_Link_FM"

StlinkCriteria = "[ind_ssn]=" & Me![ind_ssn]
DoCmd.OpenForm StDocName, , , StlinkCriteria

Exit_ind_ssn_DblClick:
Exit Sub

End Sub

Any help would be great.

Keith
 
KAnoe said:
I have a Fm that shows all records. I wouls like it so
that when the user Dblclicks the SSN of a record it will
open a form that has the same SSN. Here is the code that
I'm using.


Private Sub ind_ssn_DblClick(Cancel As Integer)

Dim StDocName As String 'Fm that is going to
open
Dim StlinkCriteria As String 'Sets the Criteria of
the record to open in the above Fm

StDocName = "DEP_SSN_Link_FM"

StlinkCriteria = "[ind_ssn]=" & Me![ind_ssn]
DoCmd.OpenForm StDocName, , , StlinkCriteria

Exit_ind_ssn_DblClick:
Exit Sub

End Sub

Any help would be great.


Help with what? That code look legal to me.

Maybe the [ind_ssn] field is a Text field??

If it is, then you need more quotes:

StlinkCriteria = "[ind_ssn]=""" & Me![ind_ssn] & """"
 
Marsh,

THAT WAS IT!! Thanks for your help!

Keith

-----Original Message-----
KAnoe said:
I have a Fm that shows all records. I wouls like it so
that when the user Dblclicks the SSN of a record it will
open a form that has the same SSN. Here is the code that
I'm using.


Private Sub ind_ssn_DblClick(Cancel As Integer)

Dim StDocName As String 'Fm that is going to
open
Dim StlinkCriteria As String 'Sets the Criteria of
the record to open in the above Fm

StDocName = "DEP_SSN_Link_FM"

StlinkCriteria = "[ind_ssn]=" & Me![ind_ssn]
DoCmd.OpenForm StDocName, , , StlinkCriteria

Exit_ind_ssn_DblClick:
Exit Sub

End Sub

Any help would be great.


Help with what? That code look legal to me.

Maybe the [ind_ssn] field is a Text field??

If it is, then you need more quotes:

StlinkCriteria = "[ind_ssn]=""" & Me![ind_ssn] & """"
 
Back
Top