What do the abbreviations for the BOF and EOF properties mean (stand for) in MS Access VBA code?

huangapple go评论44阅读模式
英文:

What do the abbreviations for the BOF and EOF properties mean (stand for) in MS Access VBA code?

问题

"End-of/Beginning-of file/field? I understand what these properties are used for but want to confirm what the letters stand for. Tried looking up but everyone, including Microsoft, is explaining what the functions do but no one has spelled out the name."

"文件/字段末尾/开头?我了解这些属性的用途,但想确认这些字母代表什么。尝试查找,但每个人,包括Microsoft,都在解释这些函数的功能,但没有人拼写出名称。"

英文:

End-of/Beginning-of file/field? I understand what these properties are used for but want to confirm what the letters stand for. Tried looking up but everyone, including Microsoft, is explaining what the functions do but no one has spelled out the name.

答案1

得分: 1

_files_的官方文档:EOF函数

没有BOF函数,但存在一个LOF函数(用于二进制文件)。

然而,对于_DAO记录集_,两者都存在,不过它们是_属性_而不是函数,用于指示当前记录指针的位置:

Recordset.BOF属性(DAO)

Recordset.EOF属性(DAO)

ADO记录集具有类似的属性。

英文:

Official documentation for files: EOF function.

There is no BOF function, but a LOF function exists (for binary files).

For DAO recordsets, however, both exists, though as properties, not functions, indication the location of the current record pointer:

Recordset.BOF property (DAO)

Recordset.EOF property (DAO)

ADO recordsets have similar properties.

答案2

得分: 1

以下是您要翻译的内容:

"EOF" 这个术语曾经在我们的行业中相当常见。

想想打孔卡片,甚至读取文件。当你“达到文件结尾”时,就完成了。

然而,这里的上下文很重要。我们并没有在读取文件,但在数据表的上下文中呢?嗯,这个术语仍然在使用。

考虑到 Microsoft Access 已经有 25 年以上的历史(四分之一世纪),那么当时在我们行业中常见的术语在今天并不那么常见。

因此,以下是这段代码在即时窗口中的输出:

id = 78 Hotel Name = Athabasca Hotel
id = 73 Hotel Name = Banff Aspen Lodge
id = 95 Hotel Name = Best Western
id = 349 Hotel Name = Four Seasons Motor
id = 9 Hotel Name = Four Seasons Motor
id = 10 Hotel Name = Heritage Inn of the South
id = 68 Hotel Name = Holiday Inn Express

因此,“EOF”(文件结尾)的典型“用法”如上所示。

英文:

the term "EOF" was actually quite common in our industry at one time.

think of punched cards, or even reading a file. You are done when you "reach end of file".

However, context here matters. We are not reading a file, but in context of a data table? Well, the term is still used.

Given that ms-access is more then 25 years old (a quarter of a century), then common terms back then in our industry are not all that common today.

So, then this:

Sub FunTest22()

    Dim rstHotels       As DAO.Recordset
    Dim strSQL          As String
    
    
    strSQL = "SELECT ID, HotelName FROM tblHotelsA ORDER BY HotelName"
    
    Set rstHotels = CurrentDb.OpenRecordset(strSQL)
    
    Do While rstHotels.EOF = False
        Debug.Print "id = " & rstHotels!ID, "Hotel Name = " & rstHotels!HotelName
        
        rstHotels.MoveNext    ' move to next row in record set
    Loop
    
    rstHotels.Close
    

End Sub

output in immediate window:

id = 78       Hotel Name = Athabasca Hotel
id = 73       Hotel Name = Banff Aspen Lodge
id = 95       Hotel Name = Best Western
id = 349      Hotel Name = Four Seasons Motor
id = 9        Hotel Name = Four Seasons Motor
id = 10       Hotel Name = Heritage Inn of the South
id = 68       Hotel Name = Holiday Inn Express

So, the typical "use" of EOF (end of file) is as per above.

huangapple
  • 本文由 发表于 2023年3月31日 03:50:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75892403.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定