shadowraven
Registered User.
- Local time
- Today, 11:07
- Joined
- May 14, 2002
- Messages
- 75
Hi Guys,Gals can anyone have a look at this code and see where it is going wrong. I would like to be able to have a button which when clicked will restart the pc if needed.
Option Compare Database
Option Explicit
Private Sub Command0_Click()
If MsgBox("Your computer needs to be rebooted. Press OK to reboot " & _
"or Cancel to Abort.", vbOKCancel + vbQuestion, "Reboot?") = vbOK Then
Dim lngRes As Long
Private Const EWX_REBOOT As Long = 2
'Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
Private Sub command1_Click()
lngRes = ExitWindowsEx(EWX_REBOOT, 0&)
End Sub
Else
Exit Sub
End If
Option Compare Database
Option Explicit
Private Sub Command0_Click()
If MsgBox("Your computer needs to be rebooted. Press OK to reboot " & _
"or Cancel to Abort.", vbOKCancel + vbQuestion, "Reboot?") = vbOK Then
Dim lngRes As Long
Private Const EWX_REBOOT As Long = 2
'Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
Private Sub command1_Click()
lngRes = ExitWindowsEx(EWX_REBOOT, 0&)
End Sub
Else
Exit Sub
End If