Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    36

    Question Unanswered: Syntax error in query expression

    Hello guys need some help here. I keep getting the following error and I have spend some time trying to figure it out.

    Syntax error (missing operator) in query expression...

    Im unsing the dlookup function to extract a value based on the following criteria:

    Dim strCriteria As String
    Dim FormNameSexo As String
    Dim FormNameTipoEdad As String
    Dim FormNameEdad As Interger
    FormNameSexo = Forms![FrmCapturaResultados].Form![Sexo]
    FormNameTipoEdad = Forms![FrmCapturaResultados].Form![TipoEdad]
    FormNameEdad = Forms![FrmCapturaResultados].Form![Edad]

    strCriteria = "([IdEstudiosDetalle] = " & Me!IdEstudiosDetalle & ") AND ([IdEstudios] = " _
    & Me!IdEstudios & ") AND ([Genero] = '" & FormNameSexo & "') AND ([TipoEdad] = '" & FormNameTipoEdad _
    & "') AND ([EdadIni] <= " & FormNameEdad & ") AND ([EdadFin] => " & FormNameEdad & ")"

    Me!LimInf = DLookup("[LimInf]", "tblEstudiosReferencias", strCriteria)
    Me!LimSup = DLookup("[LimSup]", "tblEstudiosReferencias", strCriteria)

    Im doing it this way as I'm not very good at SQL with in VB, but I'm open to any suggestions.

    thanks in advance for you help
    carlos
    Last edited by cfrankling; 11-26-10 at 17:56. Reason: changed title

  2. #2
    Join Date
    Jun 2005
    Posts
    36
    Update:
    the expression works if I remove the following:
    AND ([EdadIni] <= " & FormNameEdad & ") AND ([EdadFin] => " & FormNameEdad & ")"

    so:
    strCriteria = "([IdEstudiosDetalle] = " & Me!IdEstudiosDetalle & ") AND ([IdEstudios] = " _
    & Me!IdEstudios & ") AND ([Genero] = '" & FormNameSexo & "') AND ([TipoEdad] = '" & FormNameTipoEdad _
    & "')"

    works fine, the problem lies with the last part of the code where I need to check if the age(Edad) is within the EdadIni and EdadFin. Can't figure out why

    anybody??
    Last edited by cfrankling; 11-26-10 at 17:35.

  3. #3
    Join Date
    Jun 2005
    Posts
    36
    Update:
    Finally found the problem, turns out the => should've been >=.

Posting Permissions

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