Results 1 to 18 of 18

Thread: [RESOLVED]Const BlockSize Issue

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2012
    Location
    I'm living in VBForum bcz its members deserve respect and appreciation
    Posts
    333

    Resolved [RESOLVED]Const BlockSize Issue

    Hi folk, How are you All? I have below code it's work just fine by entered 100 record for each block and it's work fine but if i entered less than 100 record and close form and re-open it it's record new block even the previous block not completed entered. I'm looking forward for your help to prevent record new block number in case not completed the 100 record? and i try code in red but unfortunately it's not working. Thank you All.

    Code:
    Const BlockSize = 100
    Dim rsReceived As ADODB.Recordset
    Dim cn As Long, Tn As Long, Bn As Long, Bk As Long
    ----------------------------------------------------------------------
    Private Sub txtICCID_KeyPress(KeyAscii As Integer)
    'This check that all information has been entered and the saves the record
    
    Dim Nm As Double
    
      If KeyAscii = 13 And Not txtICCID.Locked Then
       If Len(txtICCID.Text) = 11 Or Len(txtICCID.Text) = 12 Then
          Nm = txtICCID.Text
          txtICCID.Text = Nm
          If Bk = 0 Then Bk = 1
          TxBlock.Text = Format(Bk, "#,##")
         rsReceived.Find "number = '" & txtICCID.Text & "'"
       If rsReceived.EOF Then
       
    rsReceived.AddNew
    
       rsReceived.Fields(0) = txtICCID.Text
       rsReceived.Fields(1) = TxBlock.Text
       rsReceived.Fields(3) = dtpReceived.Value
       rsReceived.Fields(2) = 0
       rsReceived.Fields(4) = 0
       rsReceived.Fields(5) = 0
       rsReceived.Update
    
    cn = cn + 1
            TxCount.Text = cn
            txtICCID.Text = ""
            txtICCID.SetFocus
            If cn = BlockSize Then
              Bk = Bk + 1
              MsgBox "Block Done"
              txtICCID.Locked = True
              txtICCID.SetFocus
              Else
             Bk = Bk
             End If
             
     Else
           MsgBox "Repeated"
           txtICCID.Text = ""
       End If
        Else
          txtICCID.Text = ""
          MessageBoxH Me.hwnd
              MsgBox "please enter 11 or 12 number!", vbCritical + vbMsgBoxRtlReading + vbMsgBoxRight, "Warning"
               Call OffMsg
        End If
      End If
      
    Exit Sub
    End Sub
    Last edited by brss; Aug 15th, 2012 at 01:09 PM.

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