Invalid qualifier after adding "option explicit"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zerox39
    New Member
    • Feb 2013
    • 8

    Invalid qualifier after adding "option explicit"

    I have a text box on a form that requires you put a number in, if the number is too short a msg box pops up telling you to fix it.
    I have not been declaring variables so far and the code has worked.
    Now that i learned i should declare it i went back and added the "option explicit" to my vba.
    I'm now getting the error "invalid qualifier" when compiling on this form.

    Code:
    Option Compare Database
    Option Explicit
    
    
    Private Sub Text35_AfterUpdate()
    Dim Rebatelog As Integer
    If Rebatelog.Value < 100000 Then
    MsgBox "Log number should be at least 6 characters", vbOKOnly, "Log Tools"
    End If
    End Sub
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I assume rebate log is the name of your control? You don't need to declare controls.

    Comment

    • zerox39
      New Member
      • Feb 2013
      • 8

      #3
      Yes it is a control.
      When i remove the "Dim Rebatelog As Integer" i get variable not defined.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        If rebatelog is the name of a control, why is the code running from Text35? It sounds like the name of your field is rebatelog. But the name of your control is Text35. In which case you need to use Text35, not rebatelog.

        Comment

        • zerox39
          New Member
          • Feb 2013
          • 8

          #5
          This sorted it out.

          Thanks so much

          Comment

          Working...