设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 3222|回复: 4
打印 上一主题 下一主题

在窗体中自动重复输入的问题

[复制链接]
跳转到指定楼层
1#
发表于 2005-4-15 02:35:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Access2000里,我想在窗体中能自动输入上一条记录的内容。

在网上找了好久终于找到了,但就是不知道他说的更改窗体的oncurrent属性该怎么改。

原文是说“Change the form's OnCurrent property to read as follows”。参见http://support.microsoft.com/kb/q136127/

小弟不知在哪里更改窗体的oncurrent属性,望大侠们指教!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅

点击这里给我发消息

2#
发表于 2005-4-23 08:56:00 | 只看该作者
我常用的方法:
1.如果是输入,使用ctr+' 获取上条记录同字段的值到新记录
2.在afterupdate事件中输入代码,循环需要设置上条记录默认值的字段,设置 文本框.defaultvalue="""" & 文本框.value & """"

3.使用微软的方法.

在窗体的oncurrent(成为当前)事件中加入 =AutoFillNewRecord([Forms]![Customers])

Function AutoFillNewRecord(F As Form)
         Dim RS As Recordset, C As Control
         Dim FillFields As String, FillAllFields As Integer

         On Error Resume Next

         ' Exit if not on the new record.
         If Not F.NewRecord Then Exit Function

         ' Goto the last record of the form recordset (to autofill form).
         Set RS = F.RecordsetClone
         RS.MoveLast

         ' Exit if you cannot move to the last record (no records).
         If Err <> 0 Then Exit Function

         ' Get the list of fields to autofill.
         FillFields = ";" & F![AutoFillNewRecordFields] & ";"

        ' If there is no criteria field, then set flag indicating ALL
        ' fields should be autofilled.
        FillAllFields = Err <> 0

        F.Painting = False

        ' Visit each field on the form.
        For Each C In F
        ' Fill the field if ALL fields are to be filled OR if the
        ' ...ControlSource field can be found in the FillFields list.
           If FillALLFields Or _
           InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
              C = RS(C.ControlSource)
           End If
        Next

        F.Painting = True

      End Function


注意:需要在窗体上先创建一个 文本框(Text box):
名称: AutoFillNewRecordFields
可见: No
默认值: Phone;Company Name;City;State;Zip (这里修改为你需要设置取上条记录的字段名)
3#
发表于 2005-4-29 23:18:00 | 只看该作者
为什么出现对话框“类型不匹配”





4#
发表于 2005-5-1 17:53:00 | 只看该作者



应把“在窗体的oncurrent(成为当前)事件中加入 =AutoFillNewRecord([Forms]![Customers])”


改为“在窗体的oncurrent(成为当前)事件中加入 =AutoFillNewRecord([Form])”
5#
发表于 2005-5-6 01:30:00 | 只看该作者
文本框.defaultvalue="""" & 文本框.value & """"

不知为什么我试了好多次都不行,请高手指点!!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-2 10:28 , Processed in 0.093570 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表