joeythelips
IS-IT--Management
Hi,
I have a command button on an ms access form which has the following code behind it:
Private Sub Command12_Click()
Dim db As Database
Dim rsmyset As Recordset
Dim MyNum As Integer
Dim MyMiss As String
Dim MyX As Integer
Set db = CurrentDb()
Set rsmyset = db.OpenRecordset("SELECT Right([RefStartup.Filename],3) AS [File No] FROM RefStartup ORDER BY Right([RefStartup.Filename],3); ", dbOpenSnapshot)
rsmyset.MoveLast
MyNum = rsmyset("file no"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
rsmyset.MoveFirst
MyMiss = "0"
Do
For MyX = 100 To MyNum
If MyX = rsmyset("file no"
Then
rsmyset.MoveNext
Else
MyMiss = IIf(MyMiss = "0", MyX, MyMiss & ", " & MyX)
End If
Next MyX
Loop Until rsmyset.EOF
rsmyset.Close
Set rsmyset = Nothing
Set db = Nothing
MsgBox "Alert: We are missing the following Startup Files: " & MyMiss
End Sub
However, when i clcik on the button, the application crashes.
Anyone have any ideas why?
J
I have a command button on an ms access form which has the following code behind it:
Private Sub Command12_Click()
Dim db As Database
Dim rsmyset As Recordset
Dim MyNum As Integer
Dim MyMiss As String
Dim MyX As Integer
Set db = CurrentDb()
Set rsmyset = db.OpenRecordset("SELECT Right([RefStartup.Filename],3) AS [File No] FROM RefStartup ORDER BY Right([RefStartup.Filename],3); ", dbOpenSnapshot)
rsmyset.MoveLast
MyNum = rsmyset("file no"
rsmyset.MoveFirst
MyMiss = "0"
Do
For MyX = 100 To MyNum
If MyX = rsmyset("file no"
rsmyset.MoveNext
Else
MyMiss = IIf(MyMiss = "0", MyX, MyMiss & ", " & MyX)
End If
Next MyX
Loop Until rsmyset.EOF
rsmyset.Close
Set rsmyset = Nothing
Set db = Nothing
MsgBox "Alert: We are missing the following Startup Files: " & MyMiss
End Sub
However, when i clcik on the button, the application crashes.
Anyone have any ideas why?
J