Calculating Time Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32661

    #16
    Try adding this line before line #9.
    Code:
    Call MsgBox(Now())
    When you convert this to an MDE & run it, see which line it complains about.

    Comment

    • Blaize
      New Member
      • Nov 2007
      • 13

      #17
      What I've done is to comment out all the code and this is the line it falls over at. I've never had this issue before I've checked my references and DAO and others are listed, like I say everything works perfectly as long as you don't generate an MDE file, really weird!? Problem is it needs to be built as an MDE file as 30-35 people will be using it... nuts!

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32661

        #18
        Sorry Blaise, is this a response to my last post or did you not see it?

        Comment

        • Blaize
          New Member
          • Nov 2007
          • 13

          #19
          Hi NeoPa,

          I've using Visual Basic with Access 2000 so Code:(Text) does not work. I tried your other and it bring a message box with the date and time, so not sure what thats trying to resolve? I know the line which causes the error message its the line where I'm passing a parameter to a query, which is line 9. Just wonder if its something simple which I've missed that the complier isn't picking up??

          Cheers,
          James

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32661

            #20
            OK James.
            A couple of things to clear up.
            1. Code:(Text) is simply the line which lets the reader know that the following text is code. The code lines themselves are numbered. The code line I was referring to was Call MsgBox(Now()).
            2. I was able to understand your earlier post explaining the problem occurred in line #9. I designed a line of code that would give even clearer understanding of what is going wrong.

            If you leave your code as it was when you last posted it, but add :
            Call MsgBox(Now())
            ... as a separate line before line #9, then we can determine from the results whether or not the function Now() is the problem or not. Refer back to post #16 for full instructions and let us know what occurrs.

            Comment

            • Blaize
              New Member
              • Nov 2007
              • 13

              #21
              Hi,

              Nah its not the Now() function which is causing the issue I've replaced Now() with todays date. Compiled, saved works fine as a MDB file, build to an MDE file and get: "The expression On Click you entered..." error. Tried loads of things to get round it, even a query with all the 'If' statements etc and still get the same error. Either something really basic or critically wrong which is causing it to fail. What I can't get over is the fact that it works perfectly well as a MDB file.

              Cheers,
              James

              Comment

              • Blaize
                New Member
                • Nov 2007
                • 13

                #22
                ...but in answer to your question, adding in the line of code Call MsgBox(Now()) it displays the date & time, click on, then you get the error message,

                Cheers,
                James

                Comment

                • Scott Price
                  Recognized Expert Top Contributor
                  • Jul 2007
                  • 1384

                  #23
                  This thread indicates that using a DAO recordset with a connected backend may require that you specifically open the backend first, before running the rest of your code.

                  The specific command given is

                  Code:
                  set db = dbengine(0).opendatabase("c:\foo\bar\mydata.mdb")
                  Obviously you'll need to change the c:\ path to reflect your database' location.

                  Regards,
                  Scott

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32661

                    #24
                    Originally posted by Blaize
                    ...but in answer to your question, adding in the line of code Call MsgBox(Now()) it displays the date & time, click on, then you get the error message,

                    Cheers,
                    James
                    Ah, an answer to the question. Just what's required.

                    The MDE file is NOT the same as an MDB file. The rules are different. I'm not sure what they all are as I never use MDEs, but at least we now know where to look (your other tests provided little or no clues in that area).

                    I will need to revisit this later as I'm running late already and need to get home. Bump the thread tomorrow if I don't post something later tonight though. If I can't sort it then I'm sure we can find someone who can now we know where the issue lies.

                    PS. It looks as if Scott has already come up with something. let us know how you fare with this.

                    Comment

                    • Blaize
                      New Member
                      • Nov 2007
                      • 13

                      #25
                      I realise that MDE and MDB files are not the same but in terms of comiling a database you would think that if something is working as a MDB file that when you come to create an MDE file it should also work.

                      The query I created is held within the database whre I have the code. The backend has already connected. I did how ever add the command to test and I still get the same issue. I can't beleive such a straight forward command is causing so much of a headache?! I'm sure I've mentioned this before but I'm using Access 2000. The parameter I'm passign to the query is a Date value.

                      Comment

                      • NeoPa
                        Recognized Expert Moderator MVP
                        • Oct 2006
                        • 32661

                        #26
                        Originally posted by Blaize
                        I realise that MDE and MDB files are not the same but in terms of comiling a database you would think that if something is working as a MDB file that when you come to create an MDE file it should also work.
                        ...
                        I wasn't trying to differentiate between the files, but between how (and if) the compiled project works.
                        You are right in that one would like to hope that they would behave in a consistent manner in both forms. However, the unfortunate fact is that they don't. There are rules to follow when converting an MDB to an MDE. You should find these explained in your help system. Never having used an MDE myself, I'm not sure what the rules are, I'm simply aware they exist.

                        This is all a bit similar to what happens when you upgrade from one version to another. There should be compatibility. In most cases there is not.

                        Comment

                        Working...