Results 1 to 4 of 4
  1. #1
    jgelpi is offline Novice
    Windows XP Access 2003
    Join Date
    May 2009
    Posts
    19

    Question Type Mismatch - HELP!


    I have the following code, but for some reason the "if" statement is not functioning properly. Instead of jumping to the "Else" statement, it simply acts as if the "IF" is not even there and continues through the code. Any ideas?

    Code:
     
    Dim AcctType
    Dim varEstate
    Dim varGift
    varGift = "2"
    varEstate = "1"
    AcctType = txtAcctType.Value
    If AcctType = varEstate Or varGift Then
    Dim strScreenName
        strScreenName = cmbROReports
        DoCmd.OpenReport strScreenName, acPreview
    'Exit_cmbROReports_Click:
    '    Exit Sub
    'Err_cmbROReports_Click:
    '    MsgBox Err.Description
    '    Resume Exit_cmbROReports_Click
    Else
        MsgBox "You have selected Estate Gift Report.  However, account type does not match.", vbOKOnly
        DoCmd.CancelEvent
        Exit Sub
    End If

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try:
    If AcctType = varEstate Or AcctType = varGift Then

  3. #3
    jgelpi is offline Novice
    Windows XP Access 2003
    Join Date
    May 2009
    Posts
    19
    Worked! Thanks!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You're welcome. Glad I could help.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-16-2009, 09:17 PM
  2. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  3. Replies: 2
    Last Post: 03-23-2009, 05:39 AM
  4. "Type Mismatch" Error
    By elmousa68 in forum Access
    Replies: 2
    Last Post: 12-05-2006, 08:28 AM
  5. Number data type
    By BernardKane in forum Access
    Replies: 1
    Last Post: 11-11-2006, 08:19 PM

Tags for this Thread

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