How to fix "ERROR Data type mismatch"?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ferwayne Yalung
    New Member
    • Jan 2011
    • 3

    How to fix "ERROR Data type mismatch"?

    How can i fix the error?

    Private Sub cmdadd2_Click()
    If cmdadd2.Caption = "ADD" Then
    cmdadd2.Caption = "SAVE"
    cmdedit2.Captio n = "CANCEL"
    buttons True, False
    a = Date
    a = Right(a, 4)
    With Adodc2.Recordse t
    .Filter = "IDnumber like 'F-" + a + "-*'"
    If Adodc2.Recordse t.RecordCount <> 0 Then
    .MoveLast
    c = !IDnumber
    idn = Right(!IDnumber , 4)
    idn = idn + 1
    b = Len(idn)

    .Filter = "isdeleted = 0"
    txtpass2.Text = GenerateCode()
    .AddNew

    If b = 1 Then

    txtid.Text = "F-" + a + "-000" + idn
    ElseIf b = 2 Then

    txtid.Text = "F-" + a + "-00" + idn
    ElseIf b = 3 Then

    txtid.Text = "F-" + a + "-0" + idn

    ElseIf b = 4 Then

    txtid.Text = "F-" + a + "-" + idn

    Else
    MsgBox "The system reached it's maximum capacity to accomodate new faculty members.", vbCritical, "System"

    End If


    Else

    With Adodc2.Recordse t
    txtpass2.Text = GenerateCode()
    .Filter = "isdeleted = 0"
    .AddNew

    txtid.Text = "F-" + a + "-0001"
    End With

    End If



    End With




    If (txtlname2.Text = "") And (txtfname2.Text = "") Then
    MsgBox "Please Fill Out the Required fields"

    Else

    With Adodc2.Recordse t


    !IDnumber = txtid.Text
    !isdeleted = 0
    !lname = txtlname2.Text
    !fname = txtfname2.Text
    !mname = txtmname2.Text
    !gender = txtgender2.Text
    !DOBirth = txtmo2.Text & Me.txtd2.Text & Me.txtcity2.Tex t
    !PBirth = txtpobirth2.Tex t
    !degree = txtdeg.Text
    !doctorate = txtdoc.Text
    !masteral = txtmas.Text
    !college = txtcol.Text
    !college3 = txtcol3.Text
    !college2 = txtcol2.Text
    !eadd = txteadd2.Text
    !address = txtaddress2.Tex t
    !city = txtcity2.Text
    !province = txtstate2.Text
    !postalCode = txtpostal2.Text
    !cnumber = txtcnumber2.Tex t
    !passcode = txtpass2.Text
    .Update




    With login.Adodc1.Re cordset

    .AddNew
    !IDNO = Text1.Text
    !passcode = txtpass.Text
    !isdeleted = 0
    !isStudent = 0
    !isAdmin = 0
    !isTeacher = 1
    .Update
    End With


    .Filter = "isdeleted = 0"


    End With


    cmdadd2.Caption = "ADD"
    cmdedit2.Captio n = "EDIT"
    buttons False, True

    End If

    End If

    End Sub
    Attached Files
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    It means you are trying to copy a data type, say of string into maybe an integer

    Comment

    Working...