Data mismatch error...please help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maika
    New Member
    • Apr 2007
    • 1

    #1

    Data mismatch error...please help!

    [PHP]lstSearchDoctor .ItemData(lstSe archDoctor.NewI ndex) = mrsDoctorList!D octorCode[/PHP]

    Where DoctorCode as String

    [PHP]lstSearchPatien t.ItemData(lstS earchPatient.Ne wIndex) = mrsPatientList! PatientNum[/PHP]

    Where PatientNum As Integer

    Runtime error (13) data mismatch

    Please help
  • SanjuMtr
    New Member
    • Mar 2007
    • 47

    #2
    Originally posted by Maika
    [PHP]lstSearchDoctor .ItemData(lstSe archDoctor.NewI ndex) = mrsDoctorList!D octorCode[/PHP]

    Where DoctorCode as String

    [PHP]lstSearchPatien t.ItemData(lstS earchPatient.Ne wIndex) = mrsPatientList! PatientNum[/PHP]

    Where PatientNum As Integer

    Runtime error (13) data mismatch

    Please help
    Hello,
    You will get the runtime error. type mismatch.
    I explain U in Details

    Look .itemdata(index as integer) can only hold the Integer value as well as decimal value. i.e is the value should be numeric
    like
    Code:
      Combo1.AddItem "saikat"  'OK
      Combo1.ItemData(Combo1.NewIndex) = 23 ' OK
      Combo1.AddItem "kaushik"
      Combo1.ItemData(Combo1.NewIndex) = 14'Ok
    Now when you use numeric value in string like "123" or "123.12" it will convert it
    in integer
    like 123 ,123 respectively
    Code:
      Combo1.AddItem "saikat"
      Combo1.ItemData(Combo1.NewIndex) = "23.23" 'no error 
    
      Combo1.AddItem "kaushik"
      Combo1.ItemData(Combo1.NewIndex) = 14 'no error 
    ' the code works fine
    Now come to the main point when you try to assign alphanumeric value like "C123" in .itemdata then it will give you the runtime error.
    Code:
      Combo1.AddItem "saikat"
      Combo1.ItemData(Combo1.NewIndex) = "abc23" ' Error occur
      Combo1.AddItem "kaushik"
      Combo1.ItemData(Combo1.NewIndex) = 14 'no error
    So the conclusation is you can't store alpha-numeric value in itemdata.
    I think u mention that the doctor code is string so it may contain code like"D123" Plz check it.
    If u want to store the doctor code then use additems property to store it.
    Hope I am cleared your confusion. good luck.

    Comment

    Working...