Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Variable Type (Access 2003)

    Is ther a function that will allow me to find the variable type of an expression?

    I am getting a type mismatch with the following expression.
    DLookup("associateSSN", "tblOneOffWorksheets", "associateSSN = '" & Me.txtassociateSSN & "' ").

    The datatype in the table is string. I am entering a string on the from. Ther is no imput mask.
    A value such as 123-45-6789 would be entered. This should check to see if this value is
    in the table and then procede to the next setp in the code, but alas, I get the "Type Mismatch" error.


    HELP.


    Thanks
    Richard

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Variable Type (Access 2003)

    If the value is not found, DLookup will return Null. Depending on what you do with the result, this may cause the type mismatch. You can also test like this:
    <code>
    If DCount("*", "tblOneOffWorksheets", "associateSSN = '" & Me.txtassociateSSN & "'") > 0 Then
    ' Value found
    ...
    End If</code>

Posting Permissions

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