Results 1 to 5 of 5
  1. #1
    superfury is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jun 2011
    Posts
    12

    Form closed in VBA; opened in Access 2007; acts like closed?

    I have a script that executes to get the value in a form (fml_Resultaten).
    When i run it it keeps giving me: "Objectvariable Or With-blockvariable Not Set"
    The form is opened on the background.



    Code:
    Sub TestRetr()
    msgbox Forms_fml_Resultaten.testfield.value
    End Sub
    Forms("fml_Resultaten"), Forms_fml_Resultaten and Form_fml_Resultaten!testfield all won't work.

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Msgbox Forms!fml_Resultaten!testfield

    should work if you have a field named testfield in the recordsource of the form named fml_Resultaten. If testfield is an unbound textbox on that form then you would use

    Forms!fml_Resultaten.testfield

    and just an FYI - the form DOES have to be open and on the correct record to get the information. You can't get that from a closed form as there is nothing to get when it is closed.

  3. #3
    superfury is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jun 2011
    Posts
    12
    Quote Originally Posted by boblarson View Post
    Msgbox Forms!fml_Resultaten!testfield

    should work if you have a field named testfield in the recordsource of the form named fml_Resultaten. If testfield is an unbound textbox on that form then you would use

    Forms!fml_Resultaten.testfield

    and just an FYI - the form DOES have to be open and on the correct record to get the information. You can't get that from a closed form as there is nothing to get when it is closed.
    Already tried those. Both give the same result. It seems that for some reason VBA thinks the forms are closed, but they're opened (without focus/inactive; data is called from a different query) in the database.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    If you can, post a copy of the database so we can see. You may either have something slightly wrong or it could need to be decompiled (see here for how) to fix the VBA code which could have gotten out of synch. If you choose to try a decompile, make a copy as a backup before doing so, just in case.

  5. #5
    superfury is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jun 2011
    Posts
    12
    Just placed a breakpoint in the function and a watch to Forms() object.
    For some reason it gives me the following data:

    Expression ___ Value ___ Type ___ Context
    [-] Forms ___ ___ Object/Forms ___ func_ResultatenInvoeren.resultaten_getscore
    |- [+] Application ___ ___ Application/Application ___ func_ResultatenInvoeren.resultaten_getscore
    |- Count ___ 1 ___ Long ___ func_ResultatenInvoeren.resultaten_getscore
    \- [+] Parent ___ ___ Object/Application ___ func_ResultatenInvoeren.resultaten_getscore

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Print a Closed case
    By lyndon.pace in forum Reports
    Replies: 1
    Last Post: 04-11-2011, 11:35 AM
  2. Can not close pop up form after second pop was opened
    By snoopy2003 in forum Programming
    Replies: 2
    Last Post: 03-09-2011, 02:56 AM
  3. Replies: 2
    Last Post: 02-15-2011, 05:13 AM
  4. Get column headings from closed Workbook
    By Deutz in forum Access
    Replies: 1
    Last Post: 12-10-2010, 09:06 AM
  5. check if all objects are closed (forms & reports)
    By RedGoneWILD in forum Access
    Replies: 2
    Last Post: 09-03-2010, 05:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums