bonekrusher
Registered User.
- Local time
- Today, 11:37
- Joined
- Nov 19, 2005
- Messages
- 266
Hi All, I have the following recordset count the number of records, if there are no records I get an error. is there a way around this?
(some info: the table "tempMX110" is based on a query "qrytempMX" and sometimes will return no records)
(some info: the table "tempMX110" is based on a query "qrytempMX" and sometimes will return no records)
Code:
' Count Number of MX-110s
DoCmd.OpenQuery ("qrytempMX")
Dim myconnection As ADODB.Connection
Dim myrecordset As New ADODB.Recordset
Dim howmany As Integer
Set myconnection = CurrentProject.Connection
myrecordset.ActiveConnection = myconnection
myrecordset.Open "tempMX110", , adOpenStatic
myrecordset.MoveFirst
While Not myrecordset.EOF
myrecordset.MoveNext
Wend
howmany = myrecordset.RecordCount
Forms![StartNew]![Vender_Setup].Form![amount] = howmany
myrecordset.Close
Set myrecordset = Nothing
Set myconnection = Nothing
Last edited: