We help IT Professionals succeed at work.
Get Started

Runtime Error 3074 Operation is not allowed when the object is closed.

Last Modified: 2012-05-10

Private Sub Authorized_User_Click()
Dim con1 As ADODB.Connection
Dim recset1 As ADODB.Recordset
Dim strSQL As String

strSQL = "INSERT INTO tblAuthorizedUser (authorizedUser, firstName, lastName, phoneNumber, email, Updater, UpdateDateTime ) values (9, 'hjgfhj', 'gfh', '5555558917', 'hjg', 'ghgh', 'gfhg'); "

Set con1 = CurrentProject.Connection

Set recset1 = New ADODB.Recordset
recset1.Open strSQL, con1
Set con1 = Nothing
Set recset1 = Nothing
End Sub

This code creates the following error, but still updates the record in MS Access. It flags the recSet1.Close line as offending. I know this is simplistic but I'm a very new programmer. Also my first question on here so if my formatting is messed up please forgive and correct. Thanks. CDDVDWeek4-3.accdb
Watch Question
Most Valuable Expert 2011
Top Expert 2015
This problem has been solved!
Unlock 2 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE