You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

咨询Access 2016中64位整数(bigint)对应的最佳VBA数据类型

最佳VBA数据类型对应Access 2016的BigInt字段

Great question—this is such a common pain point when working with 64-bit integers in Access, especially when dealing with linked tables. Let’s break this down clearly: the perfect VBA data type for Access 2016’s bigint fields is LongLong.

Why LongLong is exactly what you need

  • It’s a native 64-bit signed integer type (supported in VBA 7.0 and later, which Access 2016 uses by default). Its range (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807) matches perfectly with the standard SQL bigint data type—so you’ll never hit overflow issues when moving values between your VBA variables and Access tables/linked tables.
  • Unlike Variant Decimal, it’s a value type (not wrapped in a variant), so it’s far more efficient in terms of memory and performance. No unnecessary overhead here—just a straight-up integer that does exactly what you need.

How to use it in practice

Declare your variables like this:

Dim orderID As LongLong
Dim totalRecords As LongLong

Reading from a recordset is straightforward:

orderID = rs!OrderBigIntID ' rs is your DAO or ADO recordset

Writing back to a table works just as seamlessly:

rs!OrderBigIntID = orderID
rs.Update

Edge cases to consider

  • If you’re dealing with unsigned 64-bit integers (a rare scenario in Access/SQL), LongLong won’t cut it since it’s signed. In that case, you’d have to fall back to Variant Decimal, but this is unlikely to be your use case.
  • For Access versions older than 2010, LongLong isn’t available—but since you’re using 2016, this isn’t something you need to worry about.

Why the alternatives you mentioned aren’t ideal

  • Long is only 32-bit, maxing out at 2,147,483,647. It’s way too small for bigint values, which will lead to frustrating overflow errors.
  • Variant Decimal is overkill: it’s a 128-bit type designed for high-precision decimals, not just plain integers. The variant wrapper adds unnecessary memory usage and performance lag when all you need is a simple 64-bit whole number.

内容的提问来源于stack exchange,提问作者AndyDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 11:05:36