I have a code that is kinda and kind not working.<br>
<br>
<br>
This is the code. It is a log in form code. The problem is with the Sleep 100 and the Sleep 500 and the Sleep 25. parts of the codes. I have to change this part of the code to 'Sleep 100 and the 'Sleep 500 and the 'Sleep 25 and make them neutral and the code sorta kinda works.. If I don't I get a "Compile error" "Sub or function not defines" It has be baffeled. Thank-you Cheeco<br>
<br>
<br>
Code:
' ***********************************************************<br>
' Form: frm_main<br>
'<br>
' Function : login screen<br>
'<br>
' Date last Modified : 26/02/2007<br>
' 26/02/2007 - redesign for Sydney use. Sydney's menu now in a<br>
' switchboard format<br>
'<br>
' ***********************************************************<br>
Option Compare Database<br>
Option Explicit<br>
' ******************************************************<br>
' close form<br>
' ******************************************************<br>
Private Sub close_form_Click()<br>
On Error GoTo err_close_form_Click<br>
<br>
DoCmd.RunMacro "macro_exit"<br>
exit_close_form_Click:<br>
Exit Sub<br>
err_close_form_Click:<br>
MsgBox Err.Description<br>
Resume exit_close_form_Click<br>
End Sub<br>
' ***********************************************************<br>
' User has entered user_id and Password<br>
' ***********************************************************<br>
Private Sub cmdOK_Click()<br>
<br>
Dim rst As DAO.Recordset<br>
Dim rstV As Recordset<br>
Dim stDocName As String<br>
Dim stLinkCriteria As String<br>
Dim i As Integer<br>
Dim oPF As TSC_PF_Simple<br>
Dim s As Object<br>
Set oPF = New TSC_PF_Simple<br>
Set s = CreateObject("SAPI.SpVoice")<br>
<br>
Set s = CreateObject("SAPI.SpVoice")<br>
s.SPEAK "Good morning Susan. How are you today? Please wait while your database is being prepared for you."<br>
Set s = Nothing<br>
<br>
'Init progress form<br>
<br>
<br>
'Show the form<br>
oPF.Title = "Importing Objects" & vbNewLine & "Please wait..."<br>
oPF.UpdateTask 0, "Preparing Import"<br>
oPF.Show<br>
<br>
'Since this is just a demo, I simulate a series of slow tasks by using the sleep<br>
oPF.UpdateTask 0, "Importing forms: " & vbNewLine & 1 & " of 10"<br>
For i = 1 To 10<br>
Sleep 100<br>
oPF.UpdateTask i / 10, "Importing forms: " & vbNewLine & i & " of 10"<br>
Next<br>
<br>
<br>
'The progress form allows the user to cancel a running process, however, not that<br>
'the cancel is only reacted to when the progress form is updated.<br>
<br>
'If you want to allow the user the possibility to cancel, set the Allowcancel property to true<br>
'If user cancels an an error 8101 is raised.<br>
'oPF.AllowCancel = True<br>
<br>
'Simulate another task running<br>
oPF.UpdateTask 0, "Importing Queries:" & vbNewLine & "1 of 10"<br>
For i = 1 To 5<br>
'Sleep 500<br>
oPF.UpdateTask i / 5, "Importing Queries:" & vbNewLine & i & " of 10"<br>
Next<br>
<br>
'Simulate a third task running, but now disallow cancel for this part<br>
'oPF.AllowCancel = False<br>
'Also change the titel. Note how the form expands to accomodate the long text<br>
oPF.Title = oPF.Title & vbNewLine & "Do not turn of or unplug your device at this point"<br>
<br>
oPF.UpdateTask 0, "Importing tables:" & vbNewLine & "0 of 100"<br>
For i = 1 To 100<br>
'Sleep 25<br>
oPF.UpdateTask i / 100, "Importing tables:" & vbNewLine & i & " of 100"<br>
Next<br>
<br>
'Update title before closure. Note how the built in close delay gives just<br>
'enough time for the user to see this message.<br>
oPF.Title = "Succes" & vbNewLine & "All Done"<br>
<br>
'This code provide the greating message<br>
<br>
Set s = CreateObject("SAPI.SpVoice")<br>
s.SPEAK "You may now proceed. and have a good day."<br>
Set s = Nothing<br>
<br>
<br>
Exit_Sub:<br>
' Validate User ID and Password and then display menu items<br>
display_menu<br>
<br>
Exit_cmdOK_Click:<br>
Exit Sub<br>
Err_cmdOK_Click:<br>
MsgBox Err.Description<br>
Resume Exit_cmdOK_Click<br>
End Sub<br>
<br>
' ******************************************************<br>
' relink database<br>
' the user can relink the database by click on the word Password<br>
' on the main menu<br>
' ******************************************************<br>
Private Sub database_relink_Click()<br>
On Error GoTo Err_database_relink_Click<br>
DoCmd.OpenForm "frm_relink"<br>
<br>
Exit_database_relink_Click:<br>
Exit Sub<br>
Err_database_relink_Click:<br>
MsgBox Err.Description<br>
Resume Exit_database_relink_Click<br>
End Sub<br>
' ******************************************************<br>
' maximizee the screen<br>
' ******************************************************<br>
Private Sub Form_Load()<br>
On Error GoTo Err_Form_Load<br>
DoCmd.Maximize<br>
Exit_Form_Load:<br>
Exit Sub<br>
Err_Form_Load:<br>
MsgBox Err.Description<br>
Resume Exit_Form_Load<br>
<br>
End Sub<br>
Private Sub Form_Open(Cancel As Integer)<br>
End Sub<br>
' ****************************************************************<br>
' when the user id gets the focus, the user id and password are reset to blank<br>
' ****************************************************************<br>
Private Sub user_id_GotFocus()<br>
On Error GoTo Err_user_id_GotFocus<br>
'remove current user and password<br>
Me!user_id = Null<br>
Me!password = Null<br>
<br>
Exit_user_id_GotFocus:<br>
Exit Sub<br>
Err_user_id_GotFocus:<br>
MsgBox Err.Description<br>
Resume Exit_user_id_GotFocus<br>
End Sub<br>
<br>