Loading ...
Sorry, an error occurred while loading the content.
 

Update Field dgn 0 gagal

Expand Messages
  • Budiman gain
    rekan 2 yang baik tolong dong pencerahannya, saya ada tabel yg akan diupdate dengan 0 atau 0.088 gagal tapi bila tidak 0 misal 1 atau 2 itu bisa saya mencoba
    Message 1 of 1 , Aug 31, 2003
      rekan 2 yang baik tolong dong pencerahannya,
      saya ada tabel yg akan diupdate dengan 0 atau 0.088
      gagal tapi bila tidak 0 misal 1 atau 2 itu bisa
      saya mencoba update datanya dengan recordset
      dibawah ini contoh codingnya, sebelumnya terimakasih

      Budiman


      Option Explicit
      Dim WithEvents RS As Recordset
      Dim mbChangedByCode As Boolean
      Dim DbConn as ADODB.Connection
      '
      Private Sub CmdCalc_Click()

      RS.MoveFirst
      Do Until RS.EOF
      '
      RS.Fields("OH") = 0 atau 0.088 --> type
      data OH dec 17.3
      RS.Update
      RS.MoveNext
      Loop
      '
      End Sub

      Private Sub Form_Load()
      '
      Call Konek

      Set RS = New ADODB.Recordset
      DbConn.CursorLocation = adUseClient
      '
      SqlRs = "SELECT KDSHIP,OH FROM RCCH_AVUR ORDER BY
      KDSHIP"
      '
      RS.Open SqlRs, DbConn, adOpenDynamic,
      adLockOptimistic
      '
      End Sub

      Private Sub Konek()
      '
      Dim ConnectStr As String
      '
      MousePointer = 11

      Set DbConn = New Connection
      '
      DbConn.CursorLocation = adUseClient
      ConnectStr = "DSN=SHIPCOST;UID=gains;PWD=gain;"
      '
      DbConn.Open ConnectStr
      MousePointer = 0


      End Sub


      Private Sub RS_MoveComplete(ByVal adReason As
      ADODB.EventReasonEnum, ByVal pError As ADODB.Error,
      adStatus As ADODB.EventStatusEnum, ByVal pRecordset As
      ADODB.Recordset)
      lblStatus.Value = CStr(RS.AbsolutePosition)
      lblStatus.Refresh

      End Sub

      Private Sub RS_WillChangeRecord(ByVal adReason As
      ADODB.EventReasonEnum, ByVal cRecords As Long,
      adStatus As ADODB.EventStatusEnum, ByVal pRecordset As
      ADODB.Recordset)
      'This is where you put validation code
      'This event gets called when the following actions
      occur
      Dim bCancel As Boolean

      Select Case adReason
      Case adRsnAddNew
      Case adRsnClose
      Case adRsnDelete
      Case adRsnFirstChange
      Case adRsnMove
      Case adRsnRequery
      Case adRsnResynch
      Case adRsnUndoAddNew
      Case adRsnUndoDelete
      Case adRsnUndoUpdate
      Case adRsnUpdate
      End Select

      If bCancel Then adStatus = adStatusCancel
      End Sub



      ________________________________________________________________________
      Want to chat instantly with your online friends? Get the FREE Yahoo!
      Messenger http://uk.messenger.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.