Dear Guys, I have a button_click that deals wif the following code

With DataEnvironment1.rscommand1
.Open
.AddNew
End with

Whenever, I pressed the button for the second time, I will surely get an error stated that
The operation requested by the application is not allowed if the object is opened

If i put .close at the below .Addnew . I will get an error msg states
The operation requested by the application is not allowed in this context

How to correct this error, so that no matter how many time i click the button, my code can work?
BTW I have set my command locktype as optimistic

Ur help is deeply appreciated