Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code Error (2002/sp3)

    I have a dropdown list to select a student and then code to open that student's record.

    The code is:

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmIndividualStudentData"

    stLinkCriteria = "[LNFN]=" & "'" & Me![list]='O'Brien Mary"

    Same problem with other O' names.

    I'm pretty sure it is the ' in the name that is messing things up. How do I recode to fix the problem?

    Thanks.

    Paul

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code Error (2002/sp3)

    Try
    <code>
    stLinkCriteria = "[LNFN]=" & Chr(34) & Me![list] & Chr(34)
    </code>
    Chr(34) is the double quote character ". This should work OK as long as you have no students with double quotes in their names (a name like Earl "Fatha" Hines would cause a problem)

  3. #3
    2 Star Lounger
    Join Date
    Apr 2008
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code Error (2002/sp3)

    That worked.

    Thanks.

    Paul

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code Error (2002/sp3)

    See <post:=230,516>post 230,516</post:> for more info about using Chr(34).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •