0

I have an MS Access project which I am developing. Everything was good until I clicked the Compact and Repair Database, now every time my app hit line of code start from here Form_PersonalInfoPanel.cmboGender.Enabled = True from this method:

Public Sub setEmployeeForms(flag As Integer)

    If flag = 0 Then
        ...
    Else
        Form_EmployeePanel.txtFullName.Enabled = True
        Form_EmployeePanel.txtFullNameAr.Enabled = True
        
        Form_EmployeePanel.cmbPcn.Enabled = True
        Form_EmployeePanel.cmboDepartment.Enabled = True
        Form_EmployeePanel.cmboJob.Enabled = True
        
        Form_PersonalInfoPanel.cmboGender.Enabled = True
        Form_PersonalInfoPanel.cmboMaritalStatus.Enabled = True
        Form_PersonalInfoPanel.cmboNationality.Enabled = True
        Form_PersonalInfoPanel.txtDob.Enabled = True
        Form_PersonalInfoPanel.txtEmail.Enabled = True
        Form_PersonalInfoPanel.txtMobile.Enabled = True
    End If
    
End Sub

It now giving me:

Run-Time error '7':

Out of Memory

In the Debug mode, it says: <Object variable or With block variable not set> As for this one Form_EmployeePanel.cmboJob.Enabled = True, it works fine. My project is only 3.476 MB and I already deleted all files in my temporary folder.

Any help is much appreciated.

Anirudh Lou
  • 781
  • 2
  • 10
  • 28
  • From where do you run this code? The `Form_PersonalInfoPanel` code behind file or a standard module? – Kostas K. Jul 20 '22 at 13:34
  • I get that issue if I try to set my variable to too large of a data set. How large is your combobox list? Enabling it would mean that it has to be loaded, which might be trying to move the entire list into memory and causing the error. – Toddleson Jul 20 '22 at 13:49
  • 1
    If nothing else has changed, then try importing everything into a blank database and try running the code again. – Applecore Jul 20 '22 at 15:38
  • Before doing ^ this, try a full [Decompile](https://stackoverflow.com/a/3268188/3820271). – Andre Jul 20 '22 at 15:50
  • @KostasK. I am running it in a Form (EmployeeMgtWindow) that calls this method. This is what the hierarchy of my GUI ```EmployeeMgtWindow > EmployeePanel > PersonalInfoPanel``` – Anirudh Lou Jul 21 '22 at 05:14
  • @Toddleson my Comboboxes are mixed (Some combo boxes consist of Countries etc. while others consist of only 2 items such as gender) but I tried to comment out those consist of large items and it still gives me the ```Out of Memory``` issue. – Anirudh Lou Jul 21 '22 at 05:19
  • Assuming the form is separate and not a subform, try to reference it using the correct syntax `Forms.Form_PersonalInfoPanel.cmboGender`. – Kostas K. Jul 21 '22 at 07:36
  • @KostasK. Now it gives me this ```Object doesn't support this property or method```. – Anirudh Lou Jul 21 '22 at 08:30
  • Is the form a subform of `EmployeeMgtWindow`? – Kostas K. Jul 21 '22 at 08:40
  • Nope. It is a subform of ```EmployeePanel``` (Which is a child of ```EmployeeMgtWindow```). – Anirudh Lou Jul 21 '22 at 11:29
  • Anyway, I was able to get rid of the issue by creating a new form and using it instead. I don't know if that was the right thing to do. – Anirudh Lou Jul 21 '22 at 11:50
  • Reference to a subform should be `Me.SubformControl.Form.ControlName.Value`. – Kostas K. Jul 21 '22 at 13:41

0 Answers0