Results 1 to 3 of 3

Thread: HELP !(Update status TRUE ) in Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    BANGKOK
    Posts
    14

    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
    Sunanta K.

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,374
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    BANGKOK
    Posts
    14

    Thank you :)

    Thank you for your help Mr.robertx
    Now I can solve my problem
    Sunanta K.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width