以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  双击事件求助  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=57720)

--  作者:tuyage
--  发布时间:2014/9/29 20:39:00
--  双击事件求助


假设有表A和表B两个表,我将两个表利用“用户名”建立关联,现在我表A的双击事件代码如下:

If e.Col.Name = "课时" Then \'如果编辑的是课时列
    Forms("学员上课").Open()
    Dim pwd As String
    InputPassWord(pwd,"验证","请输入密码") \'输入密码
    If pwd = e.Row("学员密码") Then \'如果密码正确
        Tables("表B").AddNew()
    Else
        Messagebox.Show("密码错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Forms("学员上课").Close
    End If
End If


现在我想要,如果密码正确,则在表B中新增加的行自动生成双击表A中某一列所对应的用户名,如何修改代码,请求指示。。

--  作者:有点甜
--  发布时间:2014/9/29 20:42:00
--  
If e.Col.Name = "课时" Then \'如果编辑的是课时列  
    Dim pwd As String
    InputPassWord(pwd,"验证","请输入密码") \'输入密码
    If pwd = e.Row("学员密码") Then \'如果密码正确
        Forms("学员上课").Open()
        Dim nr As Row = Tables("表B").AddNew()
        nr("用户名") = e.Row("用户名")
    Else
        Messagebox.Show("密码错误","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Forms("学员上课").Close
    End If
End If

--  作者:tuyage
--  发布时间:2014/9/29 20:52:00
--  
一百和赞