出错提示:除非获得焦点,否则你不能引用该控件的属性和方法。
Private Sub Form_Open(Cancel As Integer)
jinping = ""
xiadan = ""
renwu = ""
Form!精品任务单_子表.LinkChildFields = ""
Form!精品任务单_子表.LinkMasterFields = ""
DoCmd.GoToRecord , , acNewRec
End Sub
‘上面是设置变量,设置连接字段(我想通过链接字段在输入过程中自动筛选),当打开表单的时候,转到添加新记录上面(也就是指针转到最后面去)。
Private Sub 精品任务编号_Enter()
Me.精品任务编号.BackColor = RGB(200, 200, 200)
If (Me.精品任务编号.Text = "") Then
jinping = ""
Else
End If
End Sub
Private Sub 精品任务编号_Exit(Cancel As Integer)
Me.精品任务编号.BackColor = RGB(255, 255, 255)
If (Me.精品任务编号.Text = "") Then
jinping = ""
Else
jinping = "精品任务编号"
End If
Form!精品任务单_子表.LinkMasterFields = jinping & xiadan & renwu
Form!精品任务单_子表.LinkChildFields = jinping & xiadan & renwu
End Sub
Private Sub 下单日期_Enter()
Me.下单日期.BackColor = RGB(200, 200, 200)
If (Me.下单日期.Text = "") Then
xiadan = ""
Else
End If
End Sub
Private Sub 下单日期_Exit(Cancel As Integer)
Me.下单日期.BackColor = RGB(255, 255, 255)
If (Me.下单日期.Text = "") Then
xiadan = ""
ElseIf (Me.精品任务编号.Text = "") Then
xiadan = "下单日期"
Else
xiadan = ";下单日期"
End If
Form!精品任务单_子表.LinkMasterFields = jinping & xiadan & renwu
Form!精品任务单_子表.LinkChildFields = jinping & xiadan & renwu
End Sub
Private Sub 任务日期_Enter()
Me.任务日期.BackColor = RGB(200, 200, 200)
If (Me.任务日期.Text = "") Then
renwu = ""
Else
End If
End Sub
Private Sub 任务日期_Exit(Cancel As Integer)
Me.任务日期.BackColor = RGB(255, 255, 255)
If (Me.任务日期.Text = "") Then
renwu = ""
ElseIf (Me.精品任务编号.Text = "" And Me.下单日期.Text = "") Then
renwu = "任务日期"
Else
renwu = ";任务日期"
End If
Form!精品任务单_子表.LinkMasterFields = jinping & xiadan & renwu
Form!精品任务单_子表.LinkChildFields = jinping & xiadan & renwu
End Sub
[此贴子已经被作者于2006-4-9 15:25:17编辑过]
|