Syntax Error (Missing Operator)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • UAlbanyMBA
    New Member
    • Nov 2006
    • 31

    #1

    Syntax Error (Missing Operator)

    I am getting a syntax error missing operator when I try to created a record set by selecting a record from a list box. I do not know where the error is though. Everything looks good, as a matter of fact I have very similar code elsewhere in my program and it works perfectly. Here is the code
    Code:
     Private Sub lstRequests_Click()
    
    Dim dbs As DAO.Database
    Dim rs5 As DAO.Recordset
    Set dbs = CurrentDb
    
    lstRequests.RowSource = "Value List"
    lstRequests.ColumnCount = 4
    lstRequests.RowSource = "Request ID; Date Opened; Status; Date Closed"
    
    Set rs5 = dbs.OpenRecordset("SELECT * FROM Request WHERE Request_ID =" & Me.lstRequests.Column(0))
    
    Me!txtODate = rs5(1)
    Me!cmbColor = rs5(2)
    Me!txtQuantity = rs5(3)
    Me!cmbstatus = rs5(4)
    Me!txtCDate = rs5(5)
    Me!cmbCategory = rs5(6)
    Me!cmbAction = rs5(7)
    Me!txtNotes = rs5(8)
    Me!txtCON = rs5(9)
    Me!txtPON = rs5(10)
    Me!cmbRM = rs5(12)
    Me!txtCS = rs5(13)
    Me!cmbDist = rs5(14)
    
    End Sub
    So what I want it to fill in some text boxes with data from the record set. If I replace & Me.lstRequests. Column(0) with a number i know exists, everything works fine. Any help?
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Code:
    lstRequests.RowSource = "Value List"
    lstRequests.ColumnCount = 4
    lstRequests.RowSource = "Request ID; Date Opened; Status; Date Closed"
    This part of the code right here erases everything in your listbox.

    Comment

    • UAlbanyMBA
      New Member
      • Nov 2006
      • 31

      #3
      Oh my goodness. Thank you very much for that one, everything works now. Thank you.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Originally posted by UAlbanyMBA
        Oh my goodness. Thank you very much for that one, everything works now. Thank you.
        Not a problem. Good luck.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #5
          Nice spot Rabbit.
          I zoomed straight past that bit :(

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Originally posted by NeoPa
            Nice spot Rabbit.
            I zoomed straight past that bit :(
            I did too at first, but seeing nothing blatantly wrong with the rest of the code I stepped back.

            At first I thought he was just filtering the list for use.

            Comment

            Working...