Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    159

    Unanswered: Lets fix the SQL

    This SQL in my sub is giving syntax errors. Can you fix it?
    It runs one of two sql statements. The first one runs fine but The last one is to show only those options with an id of less than 3 and it doesn't work

    Private Sub cboIncidentType_Enter()

    If Val(txtClientId.Value) < 990000 Then
    cboIncidentType.RowSource = "SELECT tblIncidentTypes.IncidentTypeId, tblIncidentTypes.IncidentTypeName FROM tblIncidentTypes ORDER BY tblIncidentTypes.IncidentTypeName;"
    Else
    cboIncidentType.RowSource = "SELECT tblIncidentTypes.IncidentTypeId, tblIncidentTypes.IncidentTypeName FROM tblIncidentTypes WHERE tblIncidentTypes.IncidentTypeId is less than 3 ORDER BY tblIncidentTypes.IncidentTypeName;"
    End If
    End Sub

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Can you fix it?
    - yes we can....

    Code:
    tblIncidentTypes.IncidentTypeId < 3
    might be worth a try
    assuming of course that tblIncidentTypes.IncidentTypeId is numeric
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2004
    Posts
    159
    Thanks! that does work better. I knew it was something simple like that but the Friday syndrome was sinking in.

Posting Permissions

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