简体   繁体   English

如何使用MS Access 2016在VBA表达式中编写数字字段?

[英]How to write a numeric field in a VBA expression using MS Access 2016?

I have a code line referencing a field as a Date format. 我有一条代码行,将字段引用为日期格式。 I need to reference another field as numeric format. 我需要引用另一个字段作为数字格式。

This is my code for a date format field: 这是我的日期格式字段的代码:

Private Sub cmbsearch_Click()
Dim varFilter As Variant, stdcard_id As String, txtname As String, txtrecord 
As String, strTableName As String
strTableName = "tbl01"
    If IsNull(Me.stdcard_id) Then
        Me.stdcard_id.SetFocus: Exit Sub
    End If

varFilter = "[dateofbirth]= # "& Forms!frm_stid_name_record & "#"
....
End Sub

This is my code line for a numeric format field, but I don't know to write the code after the "=" symbol 这是我用于数字格式字段的代码行,但是我不知道在“ =”符号后写代码

varFilter = "[std_id]="

try 尝试

Dim stdid As Long

stdid = Val(Forms!frm_stid_name_record)

varFilter = "[std_id]=" & stdid & " "

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM