获得ERROR 2501。 [英] Getting ERROR 2501.
本文介绍了获得ERROR 2501。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮我解决以下问题。我对vba编程知之甚少。我收到错误2501并声明
Please help me out with the following code. I don't know much about vba programming. I'm getting error 2501 and stating that
取消打开表单。请在下面的代码中告诉我我错在哪里。提前谢谢。
我有两种形式。
I have two forms.
Form1 :我正在打开
Form2。
推荐答案
如果IsNull(Ages)= False那么FilterStr =" [TxtAgeRange] ='" &安培;我!cboAge& "'AND"
如果IsNull(种族)= False那么FilterStr = FilterStr& " [种族] ="" &安培;我!种族& "'AND"
如果IsNull(性别)= False那么FilterStr = FilterStr& " [性别] ="" &安培;我!性别& "'AND"
如果IsNull(FirstName)= False那么FilterStr = FilterStr& "[FirstName] LIKE'*" &安培;我!FirstName& " *'AND"
如果IsNull(LastName)= False那么FilterStr = FilterStr& "[LastName] LIKE'*" &安培;我!姓氏& " *'AND"
如果IsNull(UnionStatus)= False那么FilterStr = FilterStr& " [UnionStatus] ="" &安培;我!UnionStatus& "'"
$
如果Len(FilterStr)> 0然后
  MsgBox"FilterStr变量是" + FilterStr
  FilterStr = Left(FilterStr,Len(FilterStr) - 5)
  DoCmd.OpenForm"Actor Search",,, FilterStr
结束如果
结束Sub
If IsNull(Ages) = False Then FilterStr = "[TxtAgeRange]='" & Me!cboAge & "' AND "
If IsNull(Ethnicity) = False Then FilterStr = FilterStr & "[Ethnicity]='" & Me!Ethnicity & "'AND "
If IsNull(Gender) = False Then FilterStr = FilterStr & "[Gender]='" & Me!Gender & "' AND "
If IsNull(FirstName) = False Then FilterStr = FilterStr & "[FirstName] LIKE '*" & Me!FirstName & "*' AND "
If IsNull(LastName) = False Then FilterStr = FilterStr & "[LastName] LIKE '*" & Me!LastName & "*' AND "
If IsNull(UnionStatus) = False Then FilterStr = FilterStr & "[UnionStatus]='" & Me!UnionStatus & "'"
If Len(FilterStr) > 0 Then
MsgBox "The FilterStr variable is " + FilterStr
FilterStr = Left(FilterStr, Len(FilterStr) - 5)
DoCmd.OpenForm "Actor Search", , , FilterStr
End If
End Sub
嗨苏,
在FilterStr建筑的最后一行,你没有" AND"和添加了,但是你删除了最后5个字符,代表添加的" AND"。
In the last line of the building of the FilterStr you do not have an " AND " added, nevertheless you remove the last 5 characters, which stands for the added " AND ".
Imb。
这篇关于获得ERROR 2501。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文