![]() ![]() EOF function • • 2 minutes to read • Contributors • • • • • • In this article Returns an containing the value True when the end of a file opened for Random or sequential Input has been reached. Keyence xg vision editor manually backup system. Syntax EOF( filenumber) The required filenumber is an Integer containing any valid. Remarks Use EOF to avoid the error generated by attempting to get input past the end of a file. The EOF function returns False until the end of the file has been reached. Dim rs As New ADODB.Recordset Dim strSql As String strSql = 'SELECT MyField FROM MyTable;' rs.Open strSql, CurrentProject.Connection Do While Not rs.EOF Debug.Print rs!MyField rs.MoveNext Loop rs.Close Set rs = Nothing End Function Function CreateViewAdo() 'Purpose: Create a new query using ADO. Thanks for your anwers, however does not work either. It seems that if this recordset has one record the EOF is true. Гост в 22468 бесплатно. However if the recordset. With files opened for Random or Binary access, EOF returns False until the last executed statement is unable to read an entire record. With files opened for Binary access, an attempt to read through the file by using the function until EOF returns True generates an error. Use the and functions instead of EOF when reading binary files with Input, or use Get when using the EOF function. With files opened for Output, EOF always returns True. Example This example uses the EOF function to detect the end of a file. This example assumes that MYFILE is a text file with a few lines of text. Dim InputData Open 'MYFILE' For Input As #1 ' Open file for input. Do While Not EOF(1) ' Check for end of file. Line Input #1, InputData ' Read line of data. Debug.Print InputData ' Print to the Immediate window. Loop Close #1 ' Close file. See also • Support and feedback Have questions or feedback about Office VBA or this documentation? Please see for guidance about the ways you can receive support and provide feedback.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |