Access交流中心

北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |

填充时怎样才能只填充子窗体数据而不是填充整张表

开拖拉机的BBer  发表于:2013-10-14 22:32:15  
复制

Private Sub 实际出货日_BeforeUpdate(Cancel As Integer)
If IsNull(安装开工日) Then
工程动态 = "未开工"
现场动态 = "未使用"
End If
Me.Parent.= "实际出货日"
End Sub


Private Sub Command139_Click()'GO
Call CopyFieldRecords("安装动态", Text137)
If Text137 = "实际出货日" Then
Me.安装动态.Form.实际出货日.Requery
Me.安装动态.SetFocus
Me.安装动态.Form.Controls("工程动态").SetFocus '定位字段焦点
For a = 2 To 200
Call SendKeys("未开工") '字段焦点负值
Call SendKeys("{down}") '字段焦点下移
Next a
Call SendKeys("%{F4}") 'SendKeys输出组合键ALT+F4
Call SendKeys("{ESC}")
For b = 2 To 200
Call SendKeys("{UP}") '字段焦点上移
Next b
End If


Function CopyFieldRecords(pstrTable As String, pstrField As String) As Boolean'函数代码

Dim db As dao.Database
Dim rst As Recordset
Dim vCopyDown As Variant '变体变量
CopyFieldRecords = True
On Error GoTo err_copyrecords
vCopyDown = Null
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * FROM [" & pstrTable & "]")
While Not rst.EOF
'If the field isn't blank then use this to copy down
If Nz(rst(pstrField), "") <> "" Then
     vCopyDown = rst(pstrField)
  
Else
       'Only if we have something to copy down
        If Nz(vCopyDown, "") <> "" Then
             rst.Edit
             rst(pstrField) = vCopyDown
             rst.Update
           
        End If
End If


     rst.MoveNext
Wend


exit_copyrecords:
Exit Function


err_copyrecords:
MsgBox Error, vbCritical, "Copy Fields Down Records"
CopyFieldRecords = False
GoTo exit_copyrecords


End Function


 

Top
总记录:0篇  页次:0/0 9 1 :