Results 1 to 7 of 7
  1. #1
    lelvivien is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    3

    VBA Code doesnt work in Form created by form wizard and works with blank form

    hi all..
    i have a database with one simple table...i created a form using the form wizard..i added a button and a label to the form and in the click event of the button a wrote this simple code: Me.MyLabel.visible = false...the code doesnt work and access give me an error(click on the expression of the parameter entry As prpriété type event is causing a problem .. an error occurred while Microsoft Access was communicating with the OLE server Oule ActiveX Control.)

    but the crazy thing is that when i do the same thing with a blank form or with juste using the form button...the code work without problem.

    thx.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    You selected [Event Procedure] in the event property? Then double-clicked the ellipses (...) to open the VBA procedure? Typed code in the VBA editor?

    Exactly why I don't use design wizards. They do things I don't like.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    lelvivien is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    3
    Quote Originally Posted by June7 View Post
    You selected [Event Procedure] in the event property? Then double-clicked the ellipses (...) to open the VBA procedure? Typed code in the VBA editor?

    Exactly why I don't use design wizards. They do things I don't like.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    yes i did as you said and the code works ine the blank form but with form wich was created using the form wizard it doesnt work.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    I am confused. These forms are behaving opposite to what you describe.

    The FormOK looks like one created with wizard because the controls are 'grouped', except for the button and label you added later. Grouping controls is what design wizard does.

    The FormAssErr definitely errors and I suspect it is corrupted. I had no problem building another form from scratch and the code worked.

    If you want to be able to independently resize and move the wizard-built controls, then just select all, right click > Layout > Remove.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    The error given is one that frequently shows up with corruption; have no idea why! But I'd first check the Control for corruption. We think of Forms and entire Databases when the word corruption is used, but Controls can and do become corrupt, as well!

    Delete the Control, then re-create it, and see what happens. Only takes a minute!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    lelvivien is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    3
    thx for ur reply.
    yes the code work just in this two case:
    1.by adding these control to a blank form
    2.with a form wish is created by clicking on the form button wich is considered a wizard too as u said>>formOK
    but if i use the button "form wizard" >>FormAssErr and adding the table from the dialog box that appears and next next next .....the code doesnt work.
    i only looking for reason why it doesnt work.
    you said that it is maybe corrupted..but i tried this with deferent database and the same problem occur. sorry for my bad english.
    i tried to delete the control and recreate it and the same problem.
    did it works for u when creating a new control?
    Maby there is somthing wrong with the access itself or my windows...
    and thx again

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    No, creating a new button did not work, that is why I suspected form corruption. I have NEVER used the 'form wizard'. Guess the wizard I was referring to previously was the automatic Form builder, this tool 'groups' controls.

    I have no problem building new form in your db with any of the tools and code works.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Query runs fine but report doesnt work
    By endri81 in forum Queries
    Replies: 4
    Last Post: 04-28-2012, 02:35 PM
  2. Replies: 2
    Last Post: 09-08-2011, 11:14 AM
  3. Replies: 2
    Last Post: 07-26-2011, 08:26 AM
  4. Help I dunno y it doesnt work
    By zaza123 in forum Programming
    Replies: 7
    Last Post: 07-03-2011, 06:43 PM
  5. Replies: 0
    Last Post: 02-15-2011, 01:43 PM

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