Results 1 to 8 of 8

Thread: searching for records

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    33

    searching for records

    hi,

    i have a datagrid and i am trying to search for certain records by means of a combobox. i seem to be going about it all wrong. this is the code i have to date

    Private Sub searchid_Click()
    Dim selected As String

    If searchid.Caption = "Search By Cabinet Id" Then

    selected = Combodateselect.Text

    Adocosts.Recordset.Filter = "[Cabinet Id] > " & selected
    searchid.Caption = "Cancel"

    Else
    DTservice1.Value = Date
    Adocosts.Refresh
    dbgservicecosts.Refresh
    searchid.Caption = "Search By Cabinet Id"
    End If
    End Sub

    can anyone help me with this thanks

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    any errors?
    -= a peet post =-

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    33
    ya i get an error saying

    "Arguments are of wrong type, are out of the acceptable range or are in conflict with each other"

    thanks

  4. #4
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396
    what line are you getting the error on?
    Can't Remember Birthdays or Important Dates- Never Miss any Important Date(s)

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    33
    the line

    Adocosts.Recordset.Filter = "[Cabinet Id] > " & selected

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    what is the value of selected ?
    -= a peet post =-

  7. #7
    Junior Member
    Join Date
    Oct 2002
    Location
    Singapore
    Posts
    19
    if your datatype for [cabinet ID] is text, then you should do this:
    adodc.recordset.filter=" [cabinet ID]>' " & string & " ' "

    if your datatype for [cabinet ID] is number, then you should do this:
    adodc.recordset.filter=" [cabinet ID]> " & clng(string)

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    33
    Sorry selected is a string value

    i tried that and it worked for me, thanks for your help

Posting Permissions

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



Click Here to Expand Forum to Full Width