changing data by dbcombo

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nmn
    New Member
    • Feb 2007
    • 5

    changing data by dbcombo

    i am trying to change the data on screen by dbcombo ... the code is below

    Code:
    Private Sub DBCombo1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
     Dim recSource As String
       recSource = "SELECT * FROM car WHERE car_id = " & _
       DBCombo1.BoundText
       Data1.RecordSource = recSource
       Data1.Refresh
    End Sub
    but i dont know why i am getting ;
    run time error '3061'
    too few parameters. Expected 1.

    and on the debug screen Data1.refresh is high lighted

    thanks
    Last edited by willakawill; Feb 15 '07, 09:08 PM. Reason: please use code tags when posting code
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. Try this slight alteration:
    Code:
    Private Sub DBCombo1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
     Dim recSource As String
       recSource = "SELECT * FROM car WHERE car_id = '" & _
       DBCombo1.BoundText & "'"
       Data1.RecordSource = recSource
       Data1.Refresh
    End Sub
    I think car_id is textual so you need the single quote marks

    Comment

    Working...