Still have a date problem...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Still have a date problem...

  1. #1
    Mr Reid Guest

    Still have a date problem...


    I should elaborate on my previous problem a bit. Whether the date format
    is correct or not is irrelevant. The objective is to pass a date value into
    the SQL statement through the property CboDate.Text. I got it working for
    a Name combo box(the code is shown in my first message) so why not a Date
    combo box?

    I suspect that it is simply a case of getting the syntax right with regard
    to the #'s and "'s etc:

    ------->#" & CboDate.Text & "#<--------


  2. #2
    Erin Guest

    Re: Still have a date problem...


    "Mr Reid" <christopher.reid@easington.gov.uk> wrote:
    >
    >I should elaborate on my previous problem a bit. Whether the date format
    >is correct or not is irrelevant. The objective is to pass a date value

    into
    >the SQL statement through the property CboDate.Text. I got it working for
    >a Name combo box(the code is shown in my first message) so why not a Date
    >combo box?
    >
    >I suspect that it is simply a case of getting the syntax right with regard
    >to the #'s and "'s etc:
    >
    >------->#" & CboDate.Text & "#<--------
    >

    You could try this:

    "#" & " cbodate.text " & "#"

    since the date is a recognized as a string, not a date, I think you need
    to put "" around it, as well as the #'s.



  3. #3
    Mr Reid Guest

    Re: Still have a date problem...


    Thanks. A more accurate attempt than previous attempts but it did not work.

    "Erin" <emw100@home.com> wrote:
    >
    >"Mr Reid" <christopher.reid@easington.gov.uk> wrote:
    >>
    >>I should elaborate on my previous problem a bit. Whether the date format
    >>is correct or not is irrelevant. The objective is to pass a date value

    >into
    >>the SQL statement through the property CboDate.Text. I got it working

    for
    >>a Name combo box(the code is shown in my first message) so why not a Date
    >>combo box?
    >>
    >>I suspect that it is simply a case of getting the syntax right with regard
    >>to the #'s and "'s etc:
    >>
    >>------->#" & CboDate.Text & "#<--------
    >>

    >You could try this:
    >
    >"#" & " cbodate.text " & "#"
    >
    >since the date is a recognized as a string, not a date, I think you need
    >to put "" around it, as well as the #'s.
    >
    >



  4. #4
    mtc Guest

    Re: Still have a date problem...


    "Mr Reid" <Christopher.reid@easington.gov.uk> wrote:
    >
    >Thanks. A more accurate attempt than previous attempts but it did not work.
    >
    >"Erin" <emw100@home.com> wrote:
    >>
    >>"Mr Reid" <christopher.reid@easington.gov.uk> wrote:
    >>>
    >>>I should elaborate on my previous problem a bit. Whether the date format
    >>>is correct or not is irrelevant. The objective is to pass a date value

    >>into
    >>>the SQL statement through the property CboDate.Text. I got it working

    >for
    >>>a Name combo box(the code is shown in my first message) so why not a Date
    >>>combo box?
    >>>
    >>>I suspect that it is simply a case of getting the syntax right with regard
    >>>to the #'s and "'s etc:
    >>>
    >>>------->#" & CboDate.Text & "#<--------
    >>>

    >>You could try this:
    >>
    >>"#" & " cbodate.text " & "#"
    >>
    >>since the date is a recognized as a string, not a date, I think you need
    >>to put "" around it, as well as the #'s.




    try declaring a date variable first, and then placing the text of the combo
    box in the variable, and format it. then use the date variable in the sql.

    ex:

    dim datTemp as date

    dattemp = format(cboDate.text, "MM/DD/YYYY")

    sql = "Select * from TABLE Where DATEFEILD = #" & datTemp & "#"

    mike


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center