Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2015
    Posts
    51

    Unanswered: Run time error 13 on combobox

    I have three combo boxes and a check box.
    The first combo box is based on a table query, where the type is a short text
    1
    2
    3
    J
    D

    If you mark the checkbox true it should check to see if combo1 has either J or D as a value and then let you continue, but if it does not equal j or d it should check all three combos if they have a null value and give a message box.

    Im getting a type mismatch error 13 in my code.

    If [Checkbox1] = True Then

    If Me.Combo1.Value <> "'J'" Or "'D'" Then 'THIS IS WHERE IM GETTING MY ERROR TYPE MISMATCH

    If IsNull(Me.Combo1.Value) Or IsNull(Me.Combo2.Value) Or IsNull(Me.Combo3.Value) Then
    MsgBox "Please fill all data in."
    Me.Checkbox1.Value = False
    Me.Combo1.SetFocus
    Else

    End If
    End If

    End If


    any help?

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You need to be using AND...not OR, for this kind of comparison, and you can't 'stack' the possibles like you have...you can also drop the Single Quotes around J and D; it needs to be like this

    Code:
    If Me.Combo1.Value <> "J" AND Me.Combo1.Value <>  "D" Then

    And because Value is the Default Property for a Combobox, you can actually drop that and simply use

    Code:
    If Me.Combo1 <> "J" AND Me.Combo1 <>  "D" Then


    Linq ;0)>
    Last edited by Missinglinq; 12-02-15 at 15:43.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jul 2015
    Posts
    51
    Thank you, I thought it had something to do with the type of data, like if the source was a number value and not text, but the source was text.

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Error 13 is caused by a Datatype Mismatch...but the Access Gnomes are not known for the accuracy of their error messages, especially when you have this type of syntax error that has no message of its own!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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