Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    4

    Unanswered: cocatenate two type of query

    hi frenz!
    Im using VB6, and access 2002, .
    my question is,
    i have to search the records from database by providing the details in front end lets say,
    giving date from datepicker.value(choose the date)
    giving PPV from combo1.text(wher 3 type of ppv which we can choose one)

    i have many field in myDB, two of them are date and PPV.

    how can i fetch the appropriate records from DB by giving this input.?
    how wud be the query string look like?
    "select ..... ??"
    plz assist me.
    thanx
    shah

  2. #2
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    select * from [table] where [date] = '" & datepicker.value & "' and PVV = '" & combo1.text & "'"

    i assumed that all values were both strings.
    Give me a place to code and i shall move the earth!

  3. #3
    Join Date
    Mar 2005
    Posts
    4
    Thanx fren!.
    thats my question, if i tried like that way, the error shows Type mismatch.
    so, datepicker.value is a Date format, and combo.text is a string,
    so, how can i concatenate, do i change the format?
    so, what will be the Query will be?\

  4. #4
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    select * from [table] where [date] = #" & datepicker.value & "# and PVV = '" & combo1.text & "'"

    i assumed that table.date and datepicker.value were both date values and the rest were strings.
    Give me a place to code and i shall move the earth!

  5. #5
    Join Date
    Mar 2005
    Posts
    4
    Hi!
    this works well,and yeild the result, but the records between the two days which i given thru dtp1.value and dtp2.value, is not some times give a correct result.
    eg.
    1. i cant retrive the records when 01/10/2003 to 04/10/2003
    that means, i cudnt get the single digit date.
    2.some time the dates between 10/11/2003 to 10/12/2003
    isnot also give a correct result.
    wjats the cause??
    thanx
    shah

  6. #6
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    use between query..

    ie
    select * from [table] where ([date] between #" & datepicker1.value & "# and #" & datepicker2.value & "#) and PVV = '" & combo1.text & "'"
    Give me a place to code and i shall move the earth!

Posting Permissions

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