Strange behaviour with form and subform

I tried the unbound textbox solution and at first when i did it it worked but when i saved and reopened the DB the promt was back but asking me for the textbox value this time

Well this is doing my head in trying to understand when it happens, i checked the cases suForm onCurrent and it has some VBA code

Code:
Private Sub Form_Current()
    Dim ParentDocName As String

    On Error Resume Next
    ParentDocName = Me.Parent.Name

    If Err <> 0 Then
        GoTo Form_Current_Exit
    Else
        On Error GoTo Form_Current_Err
        Me.Parent![InmateHearings Subform].Requery
    End If

Form_Current_Exit:
    Exit Sub

Form_Current_Err:
    [B]MsgBox Error$[/B]
    Resume Form_Current_Exit
End Sub

I out commented the MsgBox Error$ and saved and reopened the mainform and suddenly the promt was gone....so i removed the comment and reenabled the MsgBox Error$...hoping the promt would come back...but all works again....so, trying to understand this might not be possible haha at least i know as i mentioned before if it happens i can do a quick workaround replacing the 2nd subform object on the mainForm and manually typing in the Link Master and it workes again....strange but it works....
 
I can now only conclude that your database is experiencing some form of corruption. Give this one a try -->
 

Attachments

Give this one a try -->

Well the promt is gone, but also the functionality of updating the hearings form when selecting a different record in the cases form.

I think that is because of the out commented rows you did in the cases onCurrent event. the Me.Parent![InmateHearings Subform].Requery is the one updating the hearings form right?
 
No sure what you fixed but the first record (main) has two records in the cases form, if you select the second record in the cases form the hearings form should update to show no records in the hearings form....as there are no hearings record for that case...
 
The second record on the Cases form where CaseStatus is Dismissed updates the Hearings form to show no records. If it's not showing that way on your end then you're either using the previous version or your copy of Access is giving problems.

If you see a textbox next to the Hearings Schedule label called txtSubf1Link then this is the recent copy. Download it again and test it.
 
Sorry.....i was used to the way it worked before, there is a slight delay when you select the second row. Using the "BAD" method from before the hearings form updates instantly, but i guess its better that it works well then waiting for a weird problem do popup....

thx again for all help
 
Updated and attached.

Look at the:

* Load event of the main form
* On Current event of the Cases subform
* Record Source of the Hearings subform and notice the criteria
 

Attachments

Wow thats what im talking about...ill go through and see what you have done...

beautifull!!
 
ok i see what you have done, running the cases onCurrent from the mainforms onload, to kind of force it....loolks very nice :) and then a query source for the hearings form. Ill copy the changes to my curent DB and do some testing :P

Feels good to have people around who know what they are doing :)
 
ok i see what you have done, running the cases onCurrent from the mainforms onload, to kind of force it....loolks very nice :) and then a query source for the hearings form.
A subform loads before the main form so if you call the main form from the subform (Me.Parent) it will error. In the Cases subform the On Current event box is empty, i.e. [Event Procedure] isn't written in it, however, there's code behind that event so doing it this way ensures that it doesn't fire until we set it to [Event Procedure] in the property sheet. So to activate that event you set the box in the property sheet back to [Event Procedure] so that the code can run and it will remain so until you close the form. Therefore, we activate it when the main form loads because it loads after the subform.

Ill copy the changes to my curent DB and do some testing :P
That code is copyrighted:p
 
I'm sure the suites are nice but since their db was experiencing some form of corruption, I fear that it also exists within the prison too :D
 

Users who are viewing this thread

Back
Top Bottom