Sql DLOOKUP溢流阀6
我使用两个未绑定的Sql DLOOKUP溢流阀6,sql,database,ms-access,vba,Sql,Database,Ms Access,Vba,我使用两个未绑定的文本框作为输入,第三个文本框作为输出。 我的表格包含大约19K的记录,这Dlookup适用于。但若输入包含记录中超过5K的值,那个么我将得到溢出6错误。有什么帮助吗?这是密码 Private Sub Command4_Click() On Error GoTo Message Dim r As Integer, s As String Dim u As String r = Text0.Value s = Text2.Value u = DLookup("ActionBy",
文本框作为输入,第三个文本框作为输出。
我的表格包含大约19K的记录,这Dlookup
适用于。但若输入包含记录中超过5K的值,那个么我将得到溢出6错误。有什么帮助吗?这是密码
Private Sub Command4_Click()
On Error GoTo Message
Dim r As Integer, s As String
Dim u As String
r = Text0.Value
s = Text2.Value
u = DLookup("ActionBy", "RAW", "[requestid]=" & r & " AND [Type]='" & s & "'")
Me.Text7 = u
Exit Sub
Message:
MsgBox Err.Description & " " & Err.Number
MsgBox "Make sure you've entered the correct Values", , "Static Error"
End Sub
您的代码可能会由于许多原因而失败。请尝试此更健壮的版本:
Private Sub Command4_Click()
' Uncomment this line when code is verified:
' On Error GoTo Message
Dim r As Long
Dim s As String
Dim u As Variant
r = Nz(Text0.Value, 0)
s = Nz(Text2.Value)
u = DLookup("ActionBy", "RAW", "[requestid]=" & r & " AND [Type]='" & s & "'")
Me.Text7.Value = u
Exit Sub
Message:
MsgBox Err.Description & " " & Err.Number
MsgBox "Make sure you've entered the correct values.", , "Static Error"
End Sub
此外,请将Command4
重命名为有意义的名称。您的代码可能会因多种原因而失败。请尝试此更健壮的版本:
Private Sub Command4_Click()
' Uncomment this line when code is verified:
' On Error GoTo Message
Dim r As Long
Dim s As String
Dim u As Variant
r = Nz(Text0.Value, 0)
s = Nz(Text2.Value)
u = DLookup("ActionBy", "RAW", "[requestid]=" & r & " AND [Type]='" & s & "'")
Me.Text7.Value = u
Exit Sub
Message:
MsgBox Err.Description & " " & Err.Number
MsgBox "Make sure you've entered the correct values.", , "Static Error"
End Sub
另外,将Command4
重命名为有意义的内容。未真正找到特定记录。我随机试了一些唱片。你能告诉我为什么会这样吗?好吧,我现在下班了。我将在AM中测试它,并确认您返回…我认为整数r对于某些值来说太小了。将其更改为Long
。您最好在错误转到消息时注释行,然后再次运行,它将在错误行停止。未真正找到特定记录。我随机试了一些唱片。你能告诉我为什么会这样吗?好吧,我现在下班了。我将在AM中测试它,并确认您返回…我认为整数r对于某些值来说太小了。将其更改为Long
。您最好在错误转到消息上注释行,然后再次运行,它将在错误行停止。