0
votes

I have a following code in my access vba on button click event. Idea is to use temporary variable to forward a value from textbox into the subform:

Private Sub button_novi_ir_Click()
    On Error GoTo button_novi_ir_Click_Err

    On Error Resume Next
    TempVars("brojRN").Value = Me.brojRNtxt
    DoCmd.OpenForm "PODACI_O_IZVRŠENIM RADOVIMA_FORM", acNormal, "", "", acAdd, acNormal
    If (MacroError <> 0) Then
        Beep
        MsgBox MacroError.Description, vbOKOnly, ""
    End If

button_novi_ir_Click_Exit:
    Exit Sub

button_novi_ir_Click_Err:
    MsgBox Error$
    Resume button_novi_ir_Click_Exit

End Sub

Each time i click the button I get an error message "A problem occurred while MS Office Access was communicating with the OLE server or ActiveX Control". I really have no idea what to do about it. So, please can anyone point me in the right direction?

Thanks in advance!

1

1 Answers

0
votes

I don't know whether the accented character in your form name is an issue - I'll assume it isn't. But you shouldn't supply the empty strings "" for the FilterName and WhereCondition arguments, just use commas to skip these arguments ,,,

And this is code, not a macro, so you should be using the Err object and examine its Err.Number and Err.Description.