P.Weg
P.Weg

Reputation: 77

Access VBA throwing "Runtime Error 7 - Out of Memory"

I have a report repVersions and a form frmVersiondetails (The form has many many Textfields). I made a field on the report with an "on click" event so it would open the form for the details and load some values into that form. This worked like a charm until now. I made some changes and now I get said "Runtime Error 7".

Trying to revert the last changes I made did not help (or maybe I am missing the crucial detail I changed).

Since the form I am opening is quite big and full of textboxes on other elements (around 600-700), I thought that this issue could be caused by the number of elements on the form getting opened, so I closed the database, copied it and deleted half the elements on the form and corrected the code. I still got this error so I think that this may not derive from the number of elements on the form.

Next, I checked the values when the error occurs in the code. Here is the Codesnippet from the on click event from the report:

Private Sub Versionnumber_Click()
    DoCmd.OpenForm "frmVersiondetails"
    Form_frmVersiondetails.txtStatus.Value = Me.Statusname.Value
    Form_frmVersiondetails.txtPlatform.Value = Me.Platformname.Value
    Form_frmVersiondetails.txtVersion.Value = Me.Versionnumber.Value
    Form_frmVersiondetails.txtProjectno.Value = Me.Projektnumber.Value
    Form_frmVersiondetails.txtProjectname.Value = Me.Projectname.Value
End Sub

When I look at the values at runtime, I can see that all the values from the report (me.name.value) are shown correctly, but from the third row on from my snippet, where I assign the "status" value, hovering the mouse over the left side of the code shows the following:

"<Object variable or With block variable not set>"

This confuses me, since I only added some elements to the form, causing this. As stated above, I tried to roll back the changes I made but the error stays.

I am expecting the values to be written from the report to the form. It worked without problems and I cant find the issue.

EDIT: I tried executing every other code I have in the project and everything works as intended.

Upvotes: 1

Views: 533

Answers (2)

P.Weg
P.Weg

Reputation: 77

I fixed the Problem by creating a new form and copying the elements from the old frmVersiondetails to the new frmVersiondetailsfix form and changed parameters in the report to calling the new form instead of the old one. Sometimes, Access is a mystery to me..

Upvotes: 2

Gustav
Gustav

Reputation: 55806

Try this, using a common syntax:

Private Sub Versionnumber_Click()

    Const FormName = "frmVersiondetails"

    DoCmd.OpenForm FormName
    Forms(FormName).txtStatus.Value = Me.Statusname.Value
    Forms(FormName).txtPlatform.Value = Me.Platformname.Value
    Forms(FormName).txtVersion.Value = Me.Versionnumber.Value
    Forms(FormName).txtProjectno.Value = Me.Projektnumber.Value
    Forms(FormName).txtProjectname.Value = Me.Projectname.Value

End Sub

Upvotes: 0

Related Questions