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

📄 frminvoiceset.frm

📁 适合乡镇供电所使用电费处理系统v3 软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
MsgBox "数据库连接失败!", vbCritical
fCancelDisplay = True
End Sub

Private Sub cmd_close_Click()
Unload Me
End Sub

Private Sub cmd_default_Click()
Dim i As Integer
Dim mydb As New ADODB.Connection
Screen.MousePointer = 11


mydb.Open "DBQ=" & data_basename & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;PWD=d^j&d*s!j~;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
mydb.Execute "update [set_print] set [is_using]=0"
mydb.Close

mydb.Open "DBQ=" & data_basename & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;PWD=d^j&d*s!j~;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
mydb.Execute "update [set_print] set [is_using]=-1 where [is_default]=-1"
mydb.Close
'Call Form_Load
adotemp.RecordSource = "select [monthx],[monthy],[numberx],[numbery],[namex],[namey],[dispx],[dispy],[pricex],[pricey],[datex],[datey] from [set_print] where [is_default]=-1"
adotemp.Refresh

With adotemp.Recordset

'月份
For i = 0 To 20
   
    C_monthx.AddItem Right(Space(4) & i, 3)
    If .Fields("monthx") = i Then
        C_monthx.ListIndex = i
    End If
Next
 
    
For i = 0 To 5
    C_monthy.AddItem Right(Space(4) & i, 3)
    If .Fields("monthy") = i Then
        C_monthy.ListIndex = i
    End If
Next
  
'户号
    
For i = 6 To 26
    c_numberx.AddItem Right(Space(4) & i, 3)
    If .Fields("numberx") = i Then
        c_numberx.ListIndex = i - 6
    End If
Next
   
    
For i = 15 To 25
    c_numbery.AddItem Right(Space(4) & i, 3)
    If .Fields("numbery") = i Then
        c_numbery.ListIndex = i - 15
    End If
Next
   
'户名
    For i = 8 To 28
    c_namex.AddItem Right(Space(4) & i, 3)
    If .Fields("namex") = i Then
        c_namex.ListIndex = i - 8
    End If
Next
   
    
For i = 25 To 35
    c_namey.AddItem Right(Space(4) & i, 3)
    If .Fields("namey") = i Then
        c_namey.ListIndex = i - 25
    End If
Next
    
    
 '示数
For i = 0 To 15
    c_dispx.AddItem Right(Space(4) & i, 3)
    If .Fields("dispx") = i Then
        c_dispx.ListIndex = i
    End If
Next
    
    
For i = 45 To 55
    c_dispy.AddItem Right(Space(4) & i, 3)
    If .Fields("dispy") = i Then
        c_dispy.ListIndex = i - 45
    End If
Next
     
    
 '金额
For i = 15 To 35
    c_pricex.AddItem Right(Space(4) & i, 3)
    If .Fields("pricex") = i Then
        c_pricex.ListIndex = i - 15
    End If
Next
    
    
For i = 75 To 85
    c_pricey.AddItem Right(Space(4) & i, 3)
    If .Fields("pricey") = i Then
        c_pricey.ListIndex = i - 75
    End If
Next
   
 '日期
For i = 5 To 25
    c_datex.AddItem Right(Space(4) & i, 3)
    If .Fields("datex") = i Then
        c_datex.ListIndex = i - 5
    End If
Next
   
For i = 80 To 90
    c_datey.AddItem Right(Space(4) & i, 3)
    If .Fields("datey") = i Then
        c_datey.ListIndex = i - 80
    End If
Next
End With
Screen.MousePointer = 0
End Sub

Private Sub cmd_ok_Click()
Screen.MousePointer = 11
adotemp.RecordSource = "select [monthx],[monthy],[numberx],[numbery],[namex],[namey],[dispx],[dispy],[pricex],[pricey],[datex],[datey],[is_default],[is_using] from [set_print] where [is_default]=0"
adotemp.Refresh

If adotemp.Recordset.RecordCount = 0 Then
 With adotemp.Recordset
        .AddNew
        .Fields("monthx") = Trim(C_monthx.Text)
        .Fields("monthy") = Trim(C_monthy.Text)
        
        .Fields("numberx") = Trim(c_numberx.Text)
        .Fields("numbery") = Trim(c_numbery.Text)
        
        .Fields("namex") = Trim(c_namex.Text)
        .Fields("namey") = Trim(c_namey.Text)
        
        .Fields("dispx") = Trim(c_dispx.Text)
        .Fields("dispy") = Trim(c_dispy.Text)
        
        .Fields("pricex") = Trim(c_pricex.Text)
        .Fields("pricey") = Trim(c_pricey.Text)
        
        .Fields("datex") = Trim(c_datex.Text)
        .Fields("datey") = Trim(c_datey.Text)
        
        .Fields("is_default") = 0
        .Fields("is_using") = -1
        .Update
 End With
 adotemp.Refresh
Else
    With adotemp.Recordset
       
        .Fields("monthx") = Trim(C_monthx.Text)
        .Fields("monthy") = Trim(C_monthy.Text)
        
        .Fields("numberx") = Trim(c_numberx.Text)
        .Fields("numbery") = Trim(c_numbery.Text)
        
        .Fields("namex") = Trim(c_namex.Text)
        .Fields("namey") = Trim(c_namey.Text)
        
        .Fields("dispx") = Trim(c_dispx.Text)
        .Fields("dispy") = Trim(c_dispy.Text)
        
        .Fields("pricex") = Trim(c_pricex.Text)
        .Fields("pricey") = Trim(c_pricey.Text)
        
        .Fields("datex") = Trim(c_datex.Text)
        .Fields("datey") = Trim(c_datey.Text)
        
        .Fields("is_default") = 0
        .Fields("is_using") = -1
        .Update
 End With
 adotemp.Refresh
End If

adotemp.RecordSource = "select [monthx],[monthy],[numberx],[numbery],[namex],[namey],[dispx],[dispy],[pricex],[pricey],[datex],[datey],[is_default],[is_using] from [set_print] where [is_default]=-1"
adotemp.Refresh
  With adotemp.Recordset
  
    .Fields("is_using") = 0
    .Update
  End With
 adotemp.Refresh
Screen.MousePointer = 0
End Sub

Private Sub Form_Load()
Dim i As Integer

data_basename = App.Path & "\data\Eletricity.Mdb"

Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
Screen.MousePointer = 11
adotemp.ConnectionString = "DBQ=" & data_basename & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;PWD=d^j&d*s!j~;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
adotemp.RecordSource = "select [monthx],[monthy],[numberx],[numbery],[namex],[namey],[dispx],[dispy],[pricex],[pricey],[datex],[datey] from [set_print] where [is_using]=-1"
adotemp.Refresh

If adotemp.Recordset.RecordCount = 0 Then
       adotemp.RecordSource = "select [monthx],[monthy],[numberx],[numbery],[namex],[namey],[dispx],[dispy],[pricex],[pricey],[datex],[datey] from [set_print] where [is_default]=-1"
       adotemp.Refresh
End If
With adotemp.Recordset

'月份
For i = 0 To 20
   
    C_monthx.AddItem Right(Space(4) & i, 3)
    If .Fields("monthx") = i Then
        C_monthx.ListIndex = i
    End If
Next
 
    
For i = 0 To 5
    C_monthy.AddItem Right(Space(4) & i, 3)
    If .Fields("monthy") = i Then
        C_monthy.ListIndex = i
    End If
Next
  
'户号
    
For i = 6 To 26
    c_numberx.AddItem Right(Space(4) & i, 3)
    If .Fields("numberx") = i Then
        c_numberx.ListIndex = i - 6
    End If
Next
   
    
For i = 15 To 25
    c_numbery.AddItem Right(Space(4) & i, 3)
    If .Fields("numbery") = i Then
        c_numbery.ListIndex = i - 15
    End If
Next
   
'户名
    For i = 8 To 28
    c_namex.AddItem Right(Space(4) & i, 3)
    If .Fields("namex") = i Then
        c_namex.ListIndex = i - 8
    End If
Next
   
    
For i = 25 To 35
    c_namey.AddItem Right(Space(4) & i, 3)
    If .Fields("namey") = i Then
        c_namey.ListIndex = i - 25
    End If
Next
    
    
 '示数
For i = 0 To 15
    c_dispx.AddItem Right(Space(4) & i, 3)
    If .Fields("dispx") = i Then
        c_dispx.ListIndex = i
    End If
Next
    
    
For i = 45 To 55
    c_dispy.AddItem Right(Space(4) & i, 3)
    If .Fields("dispy") = i Then
        c_dispy.ListIndex = i - 45
    End If
Next
     
    
 '金额
For i = 15 To 35
    c_pricex.AddItem Right(Space(4) & i, 3)
    If .Fields("pricex") = i Then
        c_pricex.ListIndex = i - 15
    End If
Next
    
    
For i = 75 To 85
    c_pricey.AddItem Right(Space(4) & i, 3)
    If .Fields("pricey") = i Then
        c_pricey.ListIndex = i - 75
    End If
Next
   
 '日期
For i = 5 To 25
    c_datex.AddItem Right(Space(4) & i, 3)
    If .Fields("datex") = i Then
        c_datex.ListIndex = i - 5
    End If
Next
   
For i = 80 To 90
    c_datey.AddItem Right(Space(4) & i, 3)
    If .Fields("datey") = i Then
        c_datey.ListIndex = i - 80
    End If
Next
End With
Screen.MousePointer = 0

End Sub

⌨️ 快捷键说明

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