Need help with double click open form code

rhett7660

Still Learning....
Local time
Today, 05:12
Joined
Aug 25, 2005
Messages
371
Hello..

I have the following code that I have been trying to get to work:

Code:
Private Sub txtSocNumber_DblClick(Cancel As Integer)
On Error GoTo Err_txtSocNumber_DblClick

    Dim stDocName As String
    Dim stLinkCriteria As String

        stDocName = "FrmApplicantFullDetails"
    
    If IsNull(Me.txtSocNumber) Or Me.txtSocNumber = "" Then
        MsgBox "This record is empty", vbInformation, "No Data"
        Me.txtSocNumber.SetFocus
    Else
        stLinkCriteria = "[ApplicantID]=" & Me![InvestigatorID]
        DoCmd.OpenForm stDocName, , , stLinkCriteria
    End If

Exit_txtSocNumber_DblClick:
    Exit Sub

Err_txtSocNumber_DblClick:
    MsgBox Err.Description
    Resume Exit_txtSocNumber_DblClick
End Sub

I have the following two tables:

Applicant and Investigator

Applicant:
ApplicantID
InvestigatorID
etc

Investigator:
InvestigatorID
etc

The relationship is setup as 1 investigator to many applicants.

What I am trying do is this. I have form with a subform in it. In the subform there is applicant info IE SS# LName, FName and that is it. What I want to do is be able to double click on the SS# have the form "FrmApplicantFullDetails" open so you can view the work up on the applicant or edit info on the applicant.

Am I going about this the right way with the above code? Or is there something else I am missing in the code or is there code out that will do what I am looking for that is easier?

Thanks
R~
 
This appears to be comparing apples and oranges:

stLinkCriteria = "[ApplicantID]=" & Me![InvestigatorID]
 
What error are you receiving?
 
Is this what you really mean????
"stLinkCriteria = "[ApplicantID]=" & Me![InvestigatorID]"
 
CEH said:
Is this what you really mean????
"stLinkCriteria = "[ApplicantID]=" & Me![InvestigatorID]"

I don't think that will even compile.
 
I changed the InvestigatorID to ApplicantID and it seems to be working for now. I am going to put some more data in and see.

The error I was getting was this:

Error found need to debug
Form is shutting down

R~
 

Users who are viewing this thread

Back
Top Bottom