I have table with the Login ID and a message field. I have a form with a command button that calls this function but when the code is executed it only runs down to the third record and then quits. Anyone have any ideas??
Function Send()
Dim rst As DAO.Recordset
Dim i As Integer, NumRec As Integer
'create a recordset from your table
Set rst = CurrentDb.OpenRecordset("tblMsgBank"
'create a counter for the loop (i)
'the index starts at 0 for the 1st record
'Start the loop
With rst
.MoveLast
NumRec = .RecordCount
.MoveFirst
For i = 0 To NumRec - 1
Shell ("net send " & !LoginID & " " & !Message & ""
DoEvents
.MoveNext
Next i
End With
rst.Close
Set rst = Nothing
End Function
Christopher Abney
"There is no limit to the good you can do if you dont care who gets the credit"
[Afro]
Function Send()
Dim rst As DAO.Recordset
Dim i As Integer, NumRec As Integer
'create a recordset from your table
Set rst = CurrentDb.OpenRecordset("tblMsgBank"
'create a counter for the loop (i)
'the index starts at 0 for the 1st record
'Start the loop
With rst
.MoveLast
NumRec = .RecordCount
.MoveFirst
For i = 0 To NumRec - 1
Shell ("net send " & !LoginID & " " & !Message & ""
DoEvents
.MoveNext
Next i
End With
rst.Close
Set rst = Nothing
End Function
Christopher Abney
"There is no limit to the good you can do if you dont care who gets the credit"
[Afro]