Private Sub Command1_Click()
Text6.Text = Text1.Text & "年" & Text2.Text & "月" & Text3.Text & "日"
Text5.Text = Text1.Text + Text2.Text + Text3.Text
Text4.Text = "gz" + Text1.Text + Text2.Text + Text3.TextIf Combo1.Text = "从上个月的工资导入" Then
Dim cn As ADODB.Connection
Dim r As ADODB.Recordset
Dim str As String
Dim strsql As String
Set cn = New ADODB.Connection
Set r = New ADODB.Recordset
str = Text4.Text 'InputBox("输入表名")
'Dim s1 As String
myTableName = "职工工资基本情况"
strsql = "select * into " & str & " from " & myTableName
cn.Open pstr
r.Open strsql, pstr, adOpenStatic, adLockReadOnly
MsgBox "建表 " & str & " 成功!", 64, "提示"
Adodc2.Recordset.Fields(0) = Text6.Text
Adodc2.Recordset.Fields(1) = Text4.Text
Adodc2.Recordset.Update
Adodc2.Refresh
从上个月的工资录入该怎么实现呢,这个只能从固定的表中复制。每个月工资表的格式是例如gz20090101
Text6.Text = Text1.Text & "年" & Text2.Text & "月" & Text3.Text & "日"
Text5.Text = Text1.Text + Text2.Text + Text3.Text
Text4.Text = "gz" + Text1.Text + Text2.Text + Text3.TextIf Combo1.Text = "从上个月的工资导入" Then
Dim cn As ADODB.Connection
Dim r As ADODB.Recordset
Dim str As String
Dim strsql As String
Set cn = New ADODB.Connection
Set r = New ADODB.Recordset
str = Text4.Text 'InputBox("输入表名")
'Dim s1 As String
myTableName = "职工工资基本情况"
strsql = "select * into " & str & " from " & myTableName
cn.Open pstr
r.Open strsql, pstr, adOpenStatic, adLockReadOnly
MsgBox "建表 " & str & " 成功!", 64, "提示"
Adodc2.Recordset.Fields(0) = Text6.Text
Adodc2.Recordset.Fields(1) = Text4.Text
Adodc2.Recordset.Update
Adodc2.Refresh
从上个月的工资录入该怎么实现呢,这个只能从固定的表中复制。每个月工资表的格式是例如gz20090101
dim s as string
s= format(val(mid(Text4.Text,7,2))+1,"00") '月
if myTableName="13" then
'说明是明年
myTableName= format(val(mid(Text4.Text,3,4))+1,"0000")
myTableName= "gz"+ myTableName+ "01" + right(Text4.Text,2)
else
myTableName= left(Text4.Text,6)+ s + right(Text4.Text,2)
end if