|
Public Sub CopyRecord(frm As Form, strControlName As String) ' 本模块由海狸先生编写,在此感谢!!!
On Error Resume Next
Static j As Boolean
Dim D, i As Long
Set D = CreateObject("Scripting.Dictionary")
Dim strSName() As String
strSName = Split(strControlName, ";")
If Not j And frm.NewRecord Then
frm.Recordset.MoveLast
j = True
For i = 0 To UBound(strSName) - 1
D.Add strSName(i), frm.Recordset(frm(strSName(i)).ControlSource).Value
Next i
DoCmd.GoToRecord , , acNewRec
For i = 0 To UBound(strSName) - 1
frm(strSName(i)).Value = D(strSName(i))
Next i
j = False
End If
Set D = Nothing
End Sub
Private Sub Form_Current() ’窗体当前中引用既可
CopyRecord Me, "日期;单号;"
End Sub
|
|