|
-
Sep 20th, 2000, 03:14 AM
#1
Thread Starter
New Member
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
-
Sep 20th, 2000, 07:07 AM
#2
Hyperactive Member
I think you have to .Update after you have done .AddNew
-
Sep 20th, 2000, 07:52 PM
#3
Thread Starter
New Member
Jimbob, my program still gives me the same error msg even though i have put .update . Why do we require .open ? is there any way to make my program work without using .open
?
-
Sep 20th, 2000, 09:00 PM
#4
Lively Member
I don't think you need .open because it will open automatically if your for has an object (i.e. TextBox) connected to thet command.
Private Sub cmdNew_click()
DataEnvironment1.rscommand1.AddNew
cmdNew.Enabled = False
cmdUpdate.Enabled = True
End Sub
' Here the user will fill the TextBox which connected to a certain field.
Private Sub cmdUpdate_click()
DataEnvironment1.rscommand1.Update
cmdUpdate.Enabled = False
cmdNew.Enabled = True
End Sub
Yesterday is history ... Tomorrow is mistry .. Today is a gift.
VB6 , intermidiat
-
Sep 22nd, 2000, 03:08 PM
#5
Addicted Member
Try this...it would surely help.
With DataEnvironment1.rscommand1
IF .state = 0 then .Open
.AddNew
End with
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|