Not understanding why Error 3021 is happening

krazykaigh

Registered User.
Local time
Today, 13:04
Joined
Apr 10, 2012
Messages
11
Hi all,

I need some (more) help. So I keep getting error 3021, and I honestly cannot figure out why.

Here's the situation (attached views and text file with VB code):

I have a table for Specific Inheritances (tbl_Specific_Inherit). This table is on a subform to the main form. Now the form has one subform (sbfrm_SPC_Inherit_PrimeBene), which in turn has its own subform for alternate beneficiaries (sbfrm_SPC_Inherit_AltBene). Now, all tables are related and have cascading relationships.

So, when the Alt checkbox is selected, it will do one of two things, if checked then visible the AltBene subform. If unchecked then invisible the AltBene subform AND delete any records that are related to current Primebene. This relationship is through PrimeBene PK. Now when I leave this subform and then click inside of it, like on the Alt check box, I get an Error 3021, no current record.

Question, if I am in the subform and there is a current record that I am on how do I get this error. As you can see from images the current record has info, so how does this error manifest?

One line is causing this error. When I try to get the PrimeBene ID using:
int_SPC_In_PrimeBene_No = Me.Recordset.[spc_Bene_ID]
it comes back with Error 3021.

Kaigh
 

Attachments

  • Alt_Bene_AfterUpdate_1.jpg
    Alt_Bene_AfterUpdate_1.jpg
    40.4 KB · Views: 130
  • Alt_Bene_AfterUpdate_2.jpg
    Alt_Bene_AfterUpdate_2.jpg
    53.4 KB · Views: 133
  • Alt_Bene_AfterUpdate.txt
    Alt_Bene_AfterUpdate.txt
    1 KB · Views: 136
Last edited:
Hard to say - try commenting out your me.Requery statement and see if that solves the problem. Also, your main Form record may not be committed yet? Just some ideas.
 
Re: Not understanding why Error 3021 is happening - SOLUTION FOUND

@AccessMSSQL,

Thanks for that suggestion. I am unsure if it works because I worked out the solution.

I had: int_SPC_In_PrimeBene_No = Me.Recordset.[spc_Bene_ID]

Somewhat like AccessMSSQL suggested, I removed the .Recordset from the above statement, and it works like a charm.

Solution: int_SPC_In_PrimeBene_No = Me.[spc_Bene_ID]

The [spc_Bene_ID] actually is a choice after typing Me.(dot - dropdown of choices)

Hope this helps someone else!:)
 

Users who are viewing this thread

Back
Top Bottom