Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006

    Unanswered: Changing SQL on a query

    Here's what i have:

    i have a cascading combo box that uses an updatable row source depending on whats in the other box, on the on change event i had this. i nulled it out and tried it on the on update event and got the same results.

    when it goes to apply the query it gives me a missing operator.

    any suggestions?

    Dim XX As String
    XX = combosearch.Text
    'If blahblah = "1" Then
    'CurrentDb.QueryDefs("changequery").SQL = "Select [RFQ #] FROM [RFQ_source] WHERE [RFQ #] =" & XX
    'ElseIf blahblah = "2" Then
    'CurrentDb.QueryDefs("changequery").SQL = "Select [vender] FROM [RFQ_source] WHERE [vender] = " & XX
    'ElseIf blahblah = "3" Then
    'CurrentDb.QueryDefs("changequery").SQL = "Select [sent date] FROM [RFQ_source] WHERE [sent date] =" & XX
    'ElseIf blahblah = "4" Then
    'CurrentDb.QueryDefs("changequery").SQL = "Select [received date] FROM [RFQ_source] WHERE [Received date] =" & XX
    'End If
    DoCmd.ApplyFilter "changequery"

  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    I don't filter that way, but generally the value for date datatypes would have to be surrounded by "#", and text types by a single quote, so you might try that first.

    And about those field names with spaces and symbols...

  3. #3
    Join Date
    Dec 2004
    Madison, WI
    Yes - Paul is 100% right on the field names - ouch!
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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