Hi all,
ArtieChoke, the code that i've told you about is below.
First look at code than read below for description.
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
Private Sub Command1_Click()
Set conn = New ADODB.Connection
conn.ConnectionString = "uid=adv_server;pwd=123456;driver={SQL Server}; server=ALI_COMPAQ;database=adk;"
conn.Open
Set rs = New ADODB.Recordset
rs.LockType = adLockPessimistic
rs.CursorType = adOpenDynamic
rs.Open "SELECT * FROM ANKETLER", conn
Do While Not rs.EOF
rs("AKTIF") = 13
rs.MoveNext
Loop
End Sub
Private Sub Command2_Click()
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
Private Sub Command3_Click()
Dim rs2 As ADODB.Recordset
Dim conn2 As ADODB.Connection
Set conn2 = New ADODB.Connection
conn2.ConnectionString = "uid=adv_server;pwd=123456;driver={SQL Server};server=ALI_COMPAQ;database=adk;"
conn2.Open
Set rs2 = New ADODB.Recordset
rs2.LockType = adLockPessimistic
rs2.CursorType = adOpenDynamic
rs2.Open "SELECT * FROM ANKETLER", conn2
rs2("OLUSTURAN") = 13
rs2.MoveLast
rs2.Close
Set rs2 = Nothing
conn2.Close
Set conn2 = Nothing
End Sub
In above code, assume that command buttons click order is Command1-Command3-Command2 so that i open a connection and do some changes in command1_click, than get same recordset again in command2_click and do some changes too. Finally in command3_click i close the collection opened in command1_click.
As a result both of the changes are done without any limitation.
What i want to do is restrict the code in command2_click.
Your urgent helps are appreciated.
Thanks again
@li