InputBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omozali
    New Member
    • Nov 2006
    • 36

    #1

    InputBox

    Hi,

    Access (v 2003) is not recognizing the function InputBox

    this is my code

    Private Sub Command0_Click( )
    Dim response As String
    response = inputbox("Enter your name", "Login")
    End Sub

    I get this error
    expected variable or procedure, no project

    Any ideas?
  • blyxx86
    Contributor
    • Nov 2006
    • 258

    #2
    Originally posted by omozali
    Hi,

    Access (v 2003) is not recognizing the function InputBox

    this is my code

    Private Sub Command0_Click( )
    Dim response As String
    response = inputbox("Enter your name", "Login")
    End Sub

    I get this error
    expected variable or procedure, no project

    Any ideas?
    My idea (not close to an expert here) is that you are missing the actual command to display the input box.

    You have Response set up as a string, and you define response.

    But what is actually using "Response"

    Perhaps something like...
    Code:
    Private Sub Command0_Click()
    Dim Response As String
    Response = InputBox("Enter your name", "Login")
    MsgBox Response
    End Sub
    You had it all defined, but didn't actually have the program do anything with it.

    :)

    Comment

    • omozali
      New Member
      • Nov 2006
      • 36

      #3
      Originally posted by blyxx86
      My idea (not close to an expert here) is that you are missing the actual command to display the input box.

      You have Response set up as a string, and you define response.

      But what is actually using "Response"

      Perhaps something like...
      Code:
      Private Sub Command0_Click()
      Dim Response As String
      Response = InputBox("Enter your name", "Login")
      MsgBox Response
      End Sub
      You had it all defined, but didn't actually have the program do anything with it.

      :)
      Thanks for your response. According to access help files my code should work.
      I tried your code but received the same error message

      Comment

      • blyxx86
        Contributor
        • Nov 2006
        • 258

        #4
        Originally posted by omozali
        Thanks for your response. According to access help files my code should work.
        I tried your code but received the same error message
        Odd, I got no error message.

        Hmmm...

        Where are you putting the code? In a form, or where?

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          Originally posted by blyxx86
          Odd, I got no error message.

          Hmmm...

          Where are you putting the code? In a form, or where?
          Good point.

          This code should not be giving an error. If you took a copy and paste of your code then there is definately a problem as the editor should have changed inputbox to InputBox. If you typed it could you copy and paste as there may be an error you are not noticing.

          Also as Blyxx86 said, where are you using/putting this code?

          Mary

          Comment

          • omozali
            New Member
            • Nov 2006
            • 36

            #6
            Originally posted by mmccarthy
            Good point.

            This code should not be giving an error. If you took a copy and paste of your code then there is definately a problem as the editor should have changed inputbox to InputBox. If you typed it could you copy and paste as there may be an error you are not noticing.

            Also as Blyxx86 said, where are you using/putting this code?

            Mary

            In a form. The weird thing is with i type inputbox it does not change to InputBox
            as if it was not recognized

            Comment

            • omozali
              New Member
              • Nov 2006
              • 36

              #7
              Originally posted by omozali
              In a form. The weird thing is with i type inputbox it does not change to InputBox
              as if it was not recognized

              I open a new database and wrote the code and it worked. this is very very strange

              Comment

              • MMcCarthy
                Recognized Expert MVP
                • Aug 2006
                • 14387

                #8
                Originally posted by omozali
                I open a new database and wrote the code and it worked. this is very very strange
                It sounds as if your old database has been corrupted somehow. You should probably import everything into your new database.

                Comment

                • blyxx86
                  Contributor
                  • Nov 2006
                  • 258

                  #9
                  Originally posted by mmccarthy
                  It sounds as if your old database has been corrupted somehow. You should probably import everything into your new database.
                  Speaking of which...

                  How easily are databases corrupted? I hear the term all the time, and it kinda worries me.

                  Comment

                  • MMcCarthy
                    Recognized Expert MVP
                    • Aug 2006
                    • 14387

                    #10
                    Originally posted by blyxx86
                    Speaking of which...

                    How easily are databases corrupted? I hear the term all the time, and it kinda worries me.
                    There are a couple of things you can do.

                    In the tools -> options window under the advanced tab make sure the Default Record Locks is set to "Edited Record".

                    The other main cause is when the database is closed using the 'x' icon in the top righthand corner of Access. You need to ensure the users always close out of the database properly.

                    These don't guarantee no corruption but it is rare if both of these issues are handled.

                    Mary

                    Comment

                    • nico5038
                      Recognized Expert Specialist
                      • Nov 2006
                      • 3080

                      #11
                      First check your references.

                      Open some VBA code (e.g. by pressing [CTRL+G]) and select Tools/References.
                      Each libraryname starting with "MISSING" must be unchecked and (e.g. microsoft DAO version x.xx) replaced when necessary.

                      As access doesn't cleanup added libraries, often unnecessary refenreces are present.
                      Just delete as many as possible without getting an error executing "Debug/compile all modules"

                      When the database is corrupted try these MS Access database recovery steps:

                      1) Create a backup of the corrupt database. (Just in case of)

                      2) Create a new database and use File/Get external data/Import to get all objects of the damaged database.

                      3) Try these Microsoft solutions:
                      Repair A97/A2000:

                      Jetcomp:

                      and/or read the article:
                      ACC2000: How to Troubleshoot Corruption in a Microsoft Access Database


                      4) Bit "heavier":
                      Access decompile:


                      5) Try a recovery tool / Table rescue
                      Table datarecovery:

                      Access recovery:
                      Fix Access database files with our easy-to-use file recovery software. SecureRecovery® for Access can restore tables, queries, indexes, and more.


                      6) Ask a company (will cost $$'s ! )


                      check also: http://www.granite.ab.ca/access/corruptmdbs.htm


                      Nic;o)

                      Comment

                      Working...