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

    Re: Could not use the immedite window (Access 2003)

    I was premature in saying that the problem is fixed. My little test function works, but by the real one does not.

    I have also noticed that when it is not going to work Intellisense does not recognise the function name.

    So I have

    Public Function fncheckUnit(strUnitcode As String) As Boolean
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim sql As String
    etc

    But in the immediate window when I type
    ?fncheckUnit( intellisense does not appear asking for a string.

    If I run the same function from a command button on a form it works OK.
    Regards
    John



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

    Could not use the immediate window (Access 2003)

    My problem has just fixed itself, but I am puzzled about what was going on.

    A while ago I tried to test a new function in the immediate window, and got errors I could not work out.
    So I created a very simple test function and that would not work either. The function is shown below.

    Public Function fncheck(strsomething As String) As Boolean
    Debug.Print "function called"
    fncheck = True

    End Function

    Now that it does work I can paste in what happens in the immediate window.

    ? fncheck("abc")
    function called
    True

    What has been happening for the past hour or so is shown below. It worked oddly when it should not, and would not work when it should.
    Regards
    John



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

    Re: Could not use the immedite window (Access 2003)

    1) See if Debug | Compile <project> turns up errors, and if not, whether Intellisense works aferwards.
    2) Check for name conflicts - dou you have anything else in the database named fncheckUnit?
    3) Sometimes it helps if you do a decompile - compile - compact and repair cycle (see <post#=44865>post 44865</post#> for an easy way to decompile)
    4) If that doesn't help either, try importing all database objects into a blank new database.

  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: Could not use the immedite window (Access 2003)

    Thanks Hans

    The problems remains present most of the time. Most functions don't work in the immediate window.

    1) See if Debug | Compile <project> turns up errors, and if not, whether Intellisense works aferwards.
    I had already done that. No errors
    2) Check for name conflicts - do you have anything else in the database named fncheckUnit?
    No
    3) Sometimes it helps if you do a decompile - compile - compact and repair cycle (see post 44865 for an easy way to decompile)
    I have tried compact and repair, but not decompile. Will try that.
    4) If that doesn't help either, try importing all database objects into a blank new database.
    I think this is what I will need to do.

    I had suspected that this behaviour indicated corruption, but I wondered if there might be some other explanation.
    Regards
    John



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

    Re: Could not use the immedite window (Access 2003)

    I have now done:
    decompiled/recompiled a few times ,
    imported everything to a new db,
    converted to 2002 file format,
    converted back to 97 format.

    None of this has made any difference.

    So I will have to live without the immediate window for this project.
    Regards
    John



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

    Re: Could not use the immedite window (Access 2003)

    Does the code that causes errors in the Immediate window, work correctly if used in a form, for example in the On Click event of a command button?

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

    Re: Could not use the immedite window (Access 2003)

    Yes evertthing works OK except in the immediate window.
    Regards
    John



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

    Re: Could not use the immedite window (Access 2003)

    How bizarre! I've never heard of this before...

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

    Re: Could not use the immedite window (Access 2003)

    I did not think this would work, but it did. (No I have not fixed the problem)

    I imported the problem form into a new db, removed all code and controls except a few little test functions.

    Opened the file on a different computer and the problem is still present.
    Regards
    John



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

    Re: Could not use the immedite window (Access 2003)

    Aha! Your public functions are not in a standard module, but in a form module. A form module is not a standard module, but a class module. Public functions in a form module act as methods of the form. If you enter the following in the Immediate window, IntelliSense will work, and the code will run:

    ? Form_frmImmediate.fnchecksomething("Test")

    Note that ? Form_frmImmediate is the way the form is listed in the Project Explorer. IntelliSense would work too if you put the functions in a standard module. You can call the functions the normal way then.

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

    Re: Could not use the immedite window (Access 2003)

    AHA! I see. thank you.

    The reason my test function miraculously started working yesterday was that I put a copy of my test function in standard module, to test it there.

    So when I ran it, it was the other copy that was running.

    I am glad I pursued this. I have learnt something.
    Regards
    John



Posting Permissions

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