error msg like 'runtime error 13' & type mismatch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tiiim
    New Member
    • Sep 2007
    • 1

    error msg like 'runtime error 13' & type mismatch

    hi all

    i created two textboxes to insert date and a button..i hv this following code for that button..but when i ran error msg shows error like 'runtime error 13' & type mismatch..i hv no idea why it happens as long as i hv only simple code

    dbEnq.RecordSou rce = " select * from Enquirer where Date > '" & Format("MM/dd/yyyy", txtDate1.Text) & "'" And " Date < '" &
    Format("MM/dd/yyyy", txtDate2.Text) & "'"
    bEnq.RecordSour ce = " select * from Enquirer where LibDuty = '" & txtDate1.Text & "'"
    dbEnq.Refresh
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Run time error 13 type mismatch is only because of
    In db.openrecordse t("Tablename" ) may be you are using some where condition in
    which there may be syntex error means maybe you are using single quotes for an
    integer type of field.(this will give the above error if you are back end is
    access)

    Comment

    • QVeen72
      Recognized Expert Top Contributor
      • Oct 2006
      • 1445

      #3
      Hi,

      In SQL Statement, Wrap the Date with "#" :

      dbEnq.RecordSou rce = " select * from Enquirer where Date > #" & Format("MM/dd/yyyy", txtDate1.Text) & "# And Date < #" &
      Format("MM/dd/yyyy", txtDate2.Text) & "#"

      Dont Reserved Words as Field Names .
      Rename Date Field with some EDate or so..

      Regards
      Veena

      Comment

      Working...