Results 1 to 11 of 11
  1. #1
    Tjaaaa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    5

    Access crash

    Hi
    I have, for me a strange problem.

    Have a main fom(mainform) were a have 1 subform(SUB), i change the content of subform with me.subform.SourceObject = "name of subform"
    I do that with a simple if then else checking a field on main form

    if field = "A" then (on mainform)
    Me.SUB.SourceObject = "subform A"
    (have also tried form.mainform.SUB.SourceObject)
    else
    Me.SUB.SourceObject = "subform B"
    End if

    This procedure is called by 2 buttons who i also use for next/prev post on main form.


    So when i click next post, i check the field on main form and open the A or B subfom.
    This work fine but.. if i click on scroll bar in the subs the acces crash? It also happen if i have the access post buttons visible and i click next/prev.
    Both subs have each own require.

    Hope u can understand the question.

  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
    SUB is the name of the subform container control? What are names of the two forms used as source objects? Might have to use two subform containers, one for each of the source forms and then set Visibility property as needed.
    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
    Tjaaaa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    5
    SUB is the name of the subform container control?
    Yes SUB is the name of the subform container.

    What are names of the two forms used as source objects?
    Names? Do you mean what names of my 2 forms who i use in subfom container.

    Might have to use two subform containers, one for each of the source forms and then set Visibility property as needed.
    Okay is this a bug in access or?

  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 just wanted to make sure the container did not have same name as one of the source objects.

    I don't know if this is a bug or deliberate design. I don't remember ever trying to programmatically set SourceObject property.
    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
    Tjaaaa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    5
    The two subs have different names than the subcontainer :-)
    Is there any other way to solve my problem, or should i just have 2 sub containers controlled by the visibility property?

    And it must be a bug, or wouldnt access give a error report ?


  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    What event do you have the code in? I just tested in the form Current event and no crash and no errors.

    If setting the ObjectSource property won't work, setting visibility of two containers is only alternative I know.
    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.

  7. #7
    Tjaaaa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    5
    Hi
    Dont have the DB at home so cant tell you but i know it is the upper top event in subcontainer cant remember witch that is. Think it is on opening or something (translated from danish)

  8. #8
    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 used the OnCurrent event of the main form, not the subform.
    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.

  9. #9
    Tjaaaa is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    5
    Okay will try that tomorrow :-) Thanx.

  10. #10
    JamesRocklyn is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    2
    Real simple, Win 7 enterprise 64 bit sp1, Access 32bit 2010, new laptops, fresh loads of each. Access crashes when I try to manually copy a record. This is after the dreaded msain.dll error. We how have had two new computers with identical loads encounter the same errors upon first time to run Access. Of course Access 2007 and 2010 handle reports differently and old forms run in 2010 get scrambled.

  11. #11
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    Just a sample for you, It may help. This changes the RecordSource of the form.

    Me.Frame1296 = Me.Company_selector
    Select Case Frame1296
    Case 1
    Me.Frame1296.Tag = DLookup("[company Title]", "[application data]", " [id] = 5") ' show records from company 1
    Me.Consignment_Note_Tracking___Incoming.Form.Recor dSource = "Consignment note tracking - incoming history query"
    Me.Consignment_Note_Tracking___Outgoing.Form.Recor dSource = "Consignment note tracking - outgoing history query"
    Case 2
    Me.Frame1296.Tag = DLookup("[company Title]", "[application data]", " [id] = 4") ' show records from company 2
    Me.Consignment_Note_Tracking___Outgoing.Form.Recor dSource = "Consignment note tracking - outgoing history query"
    Me.Consignment_Note_Tracking___Incoming.Form.Recor dSource = "Consignment note tracking - incoming history query"
    Case 3
    Me.Consignment_Note_Tracking___Incoming.Form.Recor dSource = "Consignment note tracking - incoming history unfiltered"
    Me.Consignment_Note_Tracking___Outgoing.Form.Recor dSource = "Consignment note tracking - outgoing history unfiltered"
    End Select
    Me.Consignment_Note_Tracking___Incoming.Requery
    Me.Consignment_Note_Tracking___Outgoing.Requery

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

Similar Threads

  1. Diagnose Access Crash
    By Gray in forum Forms
    Replies: 0
    Last Post: 05-28-2011, 01:50 AM
  2. PivotTable View Crash
    By EDEd in forum Access
    Replies: 5
    Last Post: 01-31-2011, 12:58 AM
  3. Form Crash
    By AKQTS in forum Forms
    Replies: 3
    Last Post: 10-21-2010, 10:02 AM
  4. Replies: 14
    Last Post: 08-04-2010, 07:34 AM
  5. Query SQL Crash
    By Scorpio11 in forum Queries
    Replies: 1
    Last Post: 07-20-2010, 02:32 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