Open a form with maatching Record

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
 
M

Marshall Barton

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] & """"
 
K

KAnoe

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] & """"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top