Results 1 to 5 of 5

Thread: If error (2003)

  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If error (2003)

    Hi All,

    I am having trouble with the follwoing code:

    SelectStatus:
    strStatus = InputBox("Please select new status, 1 = validated, 2 = Followup, 3 = Check, 4 = SALT, 5 = Other External 6 = Internal Incomplete")

    If Not strStatus = "1" Or "2" Or "3" Or "4" Or "5" Or "6" Then
    MsgBox "Invalid entry, please enter an option between 1 and 6"
    GoTo SelectStatus
    Else
    End If

    Everything I enter into the input box is not valid. I am trying to force a choice of 1 to 6 in the input box, I think the problem has something todo with number and text i.e the input box is a text field and the If statement is looking for a number. But I just can't get it right.

    Many thanks

    Kevin
    Regards
    Gerbil (AKA Kevin)

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

    Re: If error (2003)

    The line

    If Not strStatus = "1" Or "2" Or "3" Or "4" Or "5" Or "6" Then

    does not do what you want. You could use

    If Not (strStatus = "1" Or strStatus = "2" Or strStatus = "3" Or strStatus = "4" Or strStatus = "5" Or strStatus = "6") Then

    But I would prefer to use a combo box from which the user can only select one of the values 1-6 instead of using InputBox.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If error (2003)

    Thanks Hans,

    A combo box is exactly what I would preferm but I cant make a popup combo box, I would have to make another form with the combo box on.

    Thanks again
    Kevin
    Regards
    Gerbil (AKA Kevin)

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: If error (2003)

    Are you launching this process from some existing form?
    If so just add the combo to the form, so that the user makes a selection before they click the relevant command button. (This assumes of course that that is what is happening.)
    Regards
    John



  5. #5
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If error (2003)

    Actually thats not a bad idea.

    Thanks
    Regards
    Gerbil (AKA Kevin)

Posting Permissions

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