Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Displaying Number of records found in msg box

Author  Topic 

oggy
Starting Member

3 Posts

Posted - 2010-12-08 : 07:54:18
I want to display the number of records found (if 2 or more), of a query result, in a message box. Code using at the moment on the Form Load:

If Me.RecordsetClone.RecordCount >= 2 Then
MsgBox "More Than One ASO Has Been Found - Enter Details For The Relevant ASO's.", vbInformation, "More records"

End If


This does not seem to do anything. What am i doing wrong. I am new to Access.

nheidorn
Starting Member

28 Posts

Posted - 2010-12-08 : 11:01:07
The RecordCount property in Access isn't always accurate unless you have traversed the entire recordset. Try adding this before your If statement:

Me.RecordsetClone.MoveLast
Me.RecordsetClone.MoveFirst

That should give you a correct RecordCount.
Go to Top of Page
   

- Advertisement -