Results 1 to 5 of 5
  1. #1
    Ranger351w is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Apr 2014
    Central Valley of California

    Question Intermittant #Type! type mismatch error.

    I have set up a button on a contact form to print out the mailing address of only the record displaying. However, I get a type mismatch error irregularly. Sometimes it works, sometimes it doesn't. Below is the code that the click event triggers.

    Option Compare Database

    Private Sub btnPrintrptHouseHolderEnvelope_Click()
    On Error GoTo Err_btnPrintrptHouseHolderEnvelope_Click

    Dim stDocName As String

    stDocName = "rptHouseHolderEnvelope"
    DoCmd.OpenReport stDocName, acPreview, , "HouseHolderID = " & Me![HouseHolderID]

    Exit Sub

    MsgBox Err.Description
    Resume Exit_btnPrintrptHouseHolderEnvelope_Click

    End Sub

    I have been racking my brain to try and find a common thread on the mismatch, but am at a loss to come up with any other possible cause for the error.

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    first you only have Option Compare Database declared.
    You should have
    Option Compare Database
    Option Explicit
    What does the underlying data look like? Are there occasional nulls? Calculations? Whats the datatypes?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Me![HouseHolderID] late binds your code so will not be picked up with option explicit and a compile, only when you run the code, try Me.HouseHolderID

    and have you confirmed that
    Me![HouseHolderID] is populated with a number every time and isn't null or a text value (perhaps a number with a space or other non numeric character)?

  4. #4
    sjlevine34's Avatar
    sjlevine34 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2020
    I have run into the same problem when I encounter an unpopulated field. If the field is supposed to be text, try testing for null with the expression len(nz(Me![HouseHolderID],"")) = 0

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Ontario, Canada
    Might as well just use Nz(Me.Householder,0)=0 and forget the Len function. I agree with Ajax - ditch the Me!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Type Mismatch Error
    By jo15765 in forum Modules
    Replies: 5
    Last Post: 06-10-2019, 11:13 AM
  2. VBA SQL Error 13 Type Mismatch
    By Larryg in forum Queries
    Replies: 11
    Last Post: 11-28-2016, 05:11 PM
  3. Type 13 (Type Mismatch) error
    By sdel_nevo in forum Programming
    Replies: 5
    Last Post: 01-22-2016, 10:01 AM
  4. Type Mismatch Error
    By thexxvi in forum Access
    Replies: 3
    Last Post: 11-10-2015, 10:11 AM
  5. type mismatch error?
    By hlcarlin in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 08:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums