VBA code for Password?

J

jo

Hi guys I have VBA to open Access, generate a report then to email works
perfect. Then the user requested a Password to protect the program so when
you open the program the switchboard is on view then the user will click on a
button to open a form and at that point the user will be requested to enter a
password which works fine for the user but my problem is how do I add this
part to my code which will generates automatically via a Schedule task. This
is the first part of my code to create the report how do add the code to
automatically enter the Password?
'------------------------------------------------------------
' checker_Query_overdue
'
'------------------------------------------------------------
Function checker_Query_overdue()
On Error GoTo checker_Query_overdue_Err

If (DCount("*", "OnOpenOverdue") > 0) Then
DoCmd.OpenReport "OnOpenOverdue", acPreview
DoCmd.OutputTo _
acOutputReport, , acFormatSNP, _
Application.CurrentProject.Path & "\Overdue.snp", False
DoCmd.Close acReport, "OnOpenOverdue", acSaveNo

Call SendNotesMail("Roller Patterns", _
Application.CurrentProject.Path & "\Overdue.snp", _
"RollerPattern", "Roller Patterns Overdue", False)
DoCmd.Close acReport, "Overdue.snp", acSaveNo

Else
Exit Function
End If
Application.Quit

checker_Query_overdue_Exit:
Exit Function

checker_Query_overdue_Err:
MsgBox Error$
Resume checker_Query_overdue_Exit
 
S

suzieeducatorfriendactivistwriterinventor

jo said:
Hi guys I have VBA to open Access, generate a report then to email works
perfect. Then the user requested a Password to protect the program so when
you open the program the switchboard is on view then the user will click
on a
button to open a form and at that point the user will be requested to
enter a
password which works fine for the user but my problem is how do I add this
part to my code which will generates automatically via a Schedule task.
This
is the first part of my code to create the report how do add the code to
automatically enter the Password?
'------------------------------------------------------------
' checker_Query_overdue
'
'------------------------------------------------------------
Function checker_Query_overdue()
On Error GoTo checker_Query_overdue_Err

If (DCount("*", "OnOpenOverdue") > 0) Then
DoCmd.OpenReport "OnOpenOverdue", acPreview
DoCmd.OutputTo _
acOutputReport, , acFormatSNP, _
Application.CurrentProject.Path & "\Overdue.snp", False
DoCmd.Close acReport, "OnOpenOverdue", acSaveNo

Call SendNotesMail("Roller Patterns", _
Application.CurrentProject.Path & "\Overdue.snp", _
"RollerPattern", "Roller Patterns Overdue", False)
DoCmd.Close acReport, "Overdue.snp", acSaveNo

Else
Exit Function
End If
Application.Quit

checker_Query_overdue_Exit:
Exit Function

checker_Query_overdue_Err:
MsgBox Error$
Resume checker_Query_overdue_Exit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top