In many cases additional information is added to the message string.
1- dim rs Ctrl Rec as Record Set is valid if your DAO reference is set correctly. Except for a generic SQL handler program I have written way back then (i still use it and it never required any updating ever since) that used non indexed tables, all the rest of my work uses indexes and since my code rarely fails if ever , I keep methods that have proven their worth , even if things could be done some other ways. For example, I never use : Dim a as String It will always be Dim a$ for me although I am not real strong on Option Explicit why bother and be nagged countless times.EOF after returning the recordset can allow the option of using some default values vs. in my code, but I very seldom use it when using DAO methods. Actually, I just looked around at some of my standard DAO procedures and did find this code: Public Function Double Val(fld As DAO. EOF Then Exit Do l = l 1 Loop End If ' If Len(Bookmark) Just as a further comment, the only other "bug" I know of in the DAO is that the default timing settings sometimes cause users to have unwanted collisions in a multi-user environment.Field, Optional d Default As Double = 0) As Double If Is Null(fld) Then Double Val = d Default Else On Error Resume Next Double Val = fld On Error Go To 0 End If End Function Honestly, don't mess with DAO much any longer, but with ADO... Spend a few minutes browsing the FAQ section of the forum. Also, I'm pretty sure that the DAO and the ADO are VERY similar (if not identical) regarding all of these relatively straightforward procedures. Record Count will always be greater than zero if there are records. Here are two functions I use instead: Public Function b Has Records(rs As Recordset) As Boolean ' The Record Count property is generally bad news. If asked, I'll post a fix that I've used for years and is working flawlessly in many installations. Set Option db Recycle LVs, 0 I had an issue once using DAO in VB5 on an Access DB where the .Take Care, Elroy Its been a while since I have used DAO but I do not remember ever needing to issue a movefirst to get to an active record when a recordset is first opened. Actually, all of my tables DO have indices (including Primary Key indices), so I'm not sure what happens on tables without an index, but that's interesting. Spend a few minutes browsing the FAQ section of the forum. Navigating down, of course, checking EOF is required.Of course there is no code there that checks to see if any records were returned so my guess would be that movefirst would also throw an error as I suspect the problem is that the recordset is empty You know what, Data Miser? I do not think the presence of or absence of indexes/primary keys would have any effect either. What threw me was my lack of understanding of the internal workings of a . I actually manually keyed values into the database, but I didn't hit the ENTER key. Consequently, although it appeared as if I had data, I really didn't. Can someone confirm my interpretation of what happened, or am I still off base in my understanding? I wrote a paper back in the early days of VB, when they introduced Variants as the default data , destroying old myths and urban legends about stronger typed variables from old time programmers (although I am one of those myself). Read the Hitch Hiker's Guide to Getting Help on the Forums. On error should not be really be used doing DAO, good coding should use BOF, EOF, No Match (index stuff).Per MSDN: "A call to either Move First or Move Last when the Recordset is empty (both BOF and EOF are True) generates an error." To avoid that situation, my general iteration of the recordset kinda looks like this Newbie? Read the Hitch Hiker's Guide to Getting Help on the Forums. Funny that you should mention that Elroy, I forgot to do it myself... Recordcount will return -1 in cases where recordcount is not supported. ' It doesn't always work right even with a Move Last. In fact, after staring at some code, I'll outline the problem. Move Last triggered an error message something like "Statement to complex to process" It took a bit to find the root of the problem, surely a simple move last can not be to complicated and the query was rather basic.