|
-
Nov 25th, 2001, 12:18 AM
#1
Thread Starter
New Member
HELP !(Update status TRUE ) in Access
I need to update status in fieldname(Check) from FALSE to TRUE
whenever I use event click,
How can I code the SQL Statement ?
I try this code:
Private Sub cmdCheck_Click()
cnMain.BeginTrans
cnMain.Execute "UPDATE tblDistribute " & _
"SET Check = 1 " & _
"WHERE DistributeID = " & txtDistributeID.Text
cnmain.CommitTrans
Data type of fieldname(DistributeID ) is Number and
Data type of fieldname(Check) is Yes/No
If anybody know please give your advise to me 
Thank you so much
-
Nov 25th, 2001, 12:42 AM
#2
Frenzied Member
Using ADO:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim SQL As String
Dim ConnectString As String
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=database_name.mdb"
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open ConnectString
SQL = "SELECT * FROM tblDistribute WHERE DistributeID=" & txtDistributeID.Text
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open SQL, cn, adOpenStatic, adLockOptimistic, adCmdText
With rs
!Check = True
.Update
End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
-
Nov 25th, 2001, 01:23 AM
#3
Thread Starter
New Member
Thank you :)
Thank you for your help Mr.robertx
Now I can solve my problem
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
|