⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sys_jldw.frm

📁 基于SQL2000的企业管理MRPII,包含进销存,财务,报关等组件,VB6开发,带文档说明.
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoprimaryRs"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "PMingLiU"
         Size            =   9
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "sys_JLDW"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


'*******************************************************
'*            曹汉华 2002.8.26.晚                      *
'*******************************************************
Private Sub cmdnext_Click(Index As Integer) '向后

  On Error GoTo GoNextError
  If Not AdoprimaryRs.Recordset.EOF Then AdoprimaryRs.Recordset.MoveNext
  If AdoprimaryRs.Recordset.EOF And AdoprimaryRs.Recordset.RecordCount > 0 Then
    Beep
    AdoprimaryRs.Recordset.MoveLast
  End If
  
  Exit Sub
GoNextError:
  MsgBox Err.Description

End Sub

Private Sub Cmdqd_Click(Index As Integer) '首端
  If AdoprimaryRs.Recordset.RecordCount > 0 Then
  If AdoprimaryRs.BOFAction = False Then
  AdoprimaryRs.Recordset.MoveFirst
  Else
  AdoprimaryRs.Recordset.MoveNext
  End If
  Else
  Exit Sub
  End If
  End Sub

Private Sub Cmdreturn_Click()
Unload Me
End Sub
Private Sub cmdxq_Click() '向前
  On Error GoTo GoPrevError
  If Not AdoprimaryRs.Recordset.BOF Then AdoprimaryRs.Recordset.MovePrevious
  If AdoprimaryRs.Recordset.BOF And AdoprimaryRs.Recordset.RecordCount > 0 Then
    Beep
    AdoprimaryRs.Recordset.MoveFirst
  End If
  
  Exit Sub
GoPrevError:
  MsgBox Err.Description
End Sub

Private Sub cmdmd_Click() '末端
 If AdoprimaryRs.Recordset.RecordCount > 0 Then
 If AdoprimaryRs.Recordset.EOF = False Then
    AdoprimaryRs.Recordset.MoveLast
    Else
    AdoprimaryRs.Recordset.MovePrevious
 End If
 Else
 Exit Sub
 End If
End Sub



Private Sub Form_Load() '列表框数据
 Me.Width = frmmain.Picture1.Width - 30
 Me.Top = frmmain.ActiveBar21.Bands("Band4").Height * 2.5 - 50
 Me.Height = frmmain.Picture1.Height - 300
 Me.Left = frmmain.Picture1.Left + 15
 If Mod_Right = False Then
    Cmdedit.Visible = False
    Else
    Cmdedit.Visible = True
 End If
 If Del_Right = False Then
    Cmddelete.Visible = False
    Else
    Cmddelete.Visible = True
 End If
 Cmdcancel.Enabled = False
 CmdOK.Enabled = False
  AdoprimaryRs.ConnectionString = Conn_Str
  AdoprimaryRs.RecordSource = "select * FROM SYS_JLDW"
  AdoprimaryRs.Refresh
  For i = 0 To Text.Count - 1
  Set Text(i).DataSource = AdoprimaryRs
  Next i
 End Sub
Private Sub Form_Unload(Cancel As Integer)
AdoprimaryRs.Recordset.Close
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) '非法退出禁止
If Cmdcancel.Enabled = True Then
If UnloadMode <> VBRUN.QueryUnloadConstants.vbFormCode Then
Cancel = 1
Exit Sub
End If
End If
End Sub

Private Sub text_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then        '向下箭头
   If Index + 1 < Text.Count Then
   Text(Index + 1).SetFocus
   Else
   Text(0).SetFocus
  End If
End If
If KeyCode = 38 Then        '向上箭头
  If Index - 1 >= 0 Then
  Text(Index - 1).SetFocus
  Else
  Text(Text.Count - 1).SetFocus
  End If
End If
End Sub

Private Sub Text_KeyPress(Index As Integer, KeyAscii As Integer)
   If KeyAscii = 13 Then    ' 按回车
      KeyAscii = 0
      SendKeys "{TAB}"
   End If
End Sub
Private Sub Cmdadd_Click()   '添加
  Cmddelete.Enabled = False
  Cmdadd.Enabled = False
  Cmdedit.Enabled = False
  Cmdreturn.Enabled = False
  CmdOK.Enabled = True
  Cmdcancel.Enabled = True
  Dim rs As Recordset
  Set rs = New Recordset
  rs.Open "select JLBH from SYS_JLDW order by JLBH", DB, adOpenStatic, adLockOptimistic
  
If rs.RecordCount < 1 Then
    bh = "0001"
   Else
   rs.MoveLast
   bhx = Trim(Str(Val(Right(rs.Fields("JLBH").Value, 3)) + 1))
   If Len(bhx) < 2 Then
     bh = "000" & bhx
   End If
   If Len(bhx) = 2 Then
   bh = "00" + bhx
   End If
   If Len(bhx) = 3 Then
   bh = "0" + bhx
   End If
   If Len(bhx) > 3 Then
   bh = bhx
   End If
End If
  On Error GoTo AddErr
  If AdoprimaryRs.Recordset.RecordCount > 0 Then
  AdoprimaryRs.Recordset.MoveLast
  End If
  AdoprimaryRs.Recordset.AddNew
  For i = 0 To Text.Count - 1
      Text(i).Locked = False
  Next i
  Text(0).SetFocus
  Text(0).Text = "J" + bh
  Exit Sub
AddErr:
  MsgBox Err.Description
End Sub

Private Sub Cmddelete_Click() '删除
 If MsgBox("是否真的删除当前记录 ?", vbYesNo + 32, "系统提示") = vbYes Then
  On Error Resume Next
  With AdoprimaryRs
    .Recordset.Delete
    .Recordset.MoveNext
    If .Recordset.EOF Then .Recordset.MoveFirst
  End With
End If
End Sub

Private Sub Cmdedit_Click() '修改
  For i = 0 To Text.Count - 1
      Text(i).Locked = False
  Next i
  Cmddelete.Enabled = False
  Cmdadd.Enabled = False
  Cmdedit.Enabled = False
  Cmdreturn.Enabled = False
  CmdOK.Enabled = True
  Cmdcancel.Enabled = True
  On Error GoTo EditErr
 
  Exit Sub
EditErr:
  MsgBox Err.Description
End Sub
Private Sub cmdCancel_Click() '取消
  For i = 0 To Text.Count - 1
      Text(i).Locked = True
  Next i
  Text(0).SetFocus
  Cmddelete.Enabled = True
  Cmdadd.Enabled = True
  Cmdedit.Enabled = True
  Cmdreturn.Enabled = True
  CmdOK.Enabled = False
  Cmdcancel.Enabled = False
  On Error Resume Next

 
  AdoprimaryRs.Recordset.CancelUpdate
  If mvBookMark > 0 Then
    AdoprimaryRs.Recordset.Bookmark = mvBookMark
  Else
    AdoprimaryRs.Recordset.MoveFirst
  End If
  

End Sub

Private Sub CmdOK_Click()    '确认
If Text(0).Text = "" Then
   MsgBox "编号或名称不能为空", 48, "提示"
   Text(0).SetFocus
   Exit Sub
End If
If Text(1).Text = "" Then
   MsgBox "编号或名称不能为空", 48, "提示"
   Text(0).SetFocus
   Exit Sub
End If
  For i = 0 To Text.Count - 1
      Text(i).Locked = True
  Next i
  Text(0).SetFocus
  Cmddelete.Enabled = True
  Cmdadd.Enabled = True
  Cmdedit.Enabled = True
  Cmdreturn.Enabled = True
  CmdOK.Enabled = False
  Cmdcancel.Enabled = False
  On Error GoTo updateErr
  AdoprimaryRs.Recordset.UpdateBatch adAffectAll
  If AdoprimaryRs.Recordset.BOF = False Then
    AdoprimaryRs.Recordset.MovePrevious
    AdoprimaryRs.Recordset.MoveNext
  End If
  If AdoprimaryRs.Recordset.BOF = True Then
    AdoprimaryRs.Recordset.MoveNext
    AdoprimaryRs.Recordset.MovePrevious
  End If
   AdoprimaryRs.Recordset.Requery
  Cmdcancel.Enabled = False
  CmdOK.Enabled = False
  Exit Sub
updateErr:
  MsgBox Err.Description
End Sub





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -