0
votes

I've built a form in MS Access 2010 using multiple subforms in a tabbed control. Some of the subforms contain a TextField with an OnClick Macro opening a PopUp Form. When clicking the "OK"-Button, it calculates a value using someFn(), gets the current Tab from the Main Form and writes the value into the TextField in the corresponding SubForm.

This is the Code for the "OK"-Button in the PopUp Form:

Private Sub btn_ok_Click()
    Dim page As Integer
    page = Forms![00_data].Form.tabbed.Value
    Dim Val As Integer
    Val = someFn 'returns some Value between -1 and 100
    DoCmd.Close acForm, "10_my_popup_form", acSaveNo
    If Val >= 0 Then '0-100 are valid
        Select Case page
            Case 0
                Forms![00_main]![01_subform].Form.txt_field.Value = Val
            Case 3
                Forms![00_main]![04_subform].Form.txt_field.Value = Val 'Error 459
        End Select
    ElseIf Val = -1 Then '-1 is an error code, delete the Value
        Select Case page
            Case 0
                Forms![00_main]![01_subform].Form.txt_field.Value = Null
            Case 3
                Forms![00_main]![04_subform].Form.txt_field.Value = Null 'Error 459
        End Select
    End If
End Sub

The Sub runs perfectly fine if I click the txt_field on 01_subform (Tab 0) but why does it throw an Error on 04_subform (Tab 3)?

EDIT: I've found this microsoft article that mentions the error but none of the problem-solving approaches could fix the problem: http://support.microsoft.com/kb/2748410

As I've created 01_subform on 2014/01/26 and the update was installed on 2014/01/27 before I created 04_subform, this might really be the reason, but how do I fix it?

1
If you haven't done so already you could try a thorough decompile and re-compile of the Access database.Gord Thompson
I haven't done that already, but after recompiling the DB I get a Runtime Error '-2146500594 (800f000e)': Method 'Form' of object '_SubForm' failed, only for 04_subform againJohannes Trümpelmann

1 Answers

1
votes

As after recompiling the database some other Errors were thrown I have created a new form, copied all controls and the VBA code into it, renamed the subforms and swapped them, everything is working fine now.