+ Reply to Thread
Results 1 to 3 of 3

another type mismatch

  1. #1
    Registered User
    Join Date
    11-16-2006
    Posts
    42

    another type mismatch

    I'm inputting a txtUserFilename from a textbox. That's the name I gave the
    textbox in its properties.

    Here's the code I have:

    Private Sub cmdNext_Click()

    txtUserFilename = Trim(txtUserFilename)
    If txtUserFilename = vbNullString Then
    MsgBox "You Must Enter a Valid Filename", , "Enter File Name"
    txtUserFilename.SetFocus
    Exit Sub
    End If

    If txtUserFilename = "Asset" Or "asset" Then MsgBox "You Must Enter a Valid USER Filename", , "Enter File Name"
    txtUserFilename.SetFocus
    Exit Sub
    End If
    End Sub

    I'm getting a type mismatch on the line: If txtUserFilename = "Asset.....
    I've tried txtUserFilename.txt and .value but that's not it.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Marcmarc,

    The problem is with the "OR" operator. You must specify a another comparasion operator that evaluates to either TRUE or FLASE.

    Try This...

    Please Login or Register  to view this content.
    If you want the code to be case insensitive you could simply use...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    11-16-2006
    Posts
    42

    re type mismatch

    If it was a snake, it woulda bit me!
    That did the trick!
    Thank you, Leith
    Marc

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1