Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Security / May 2007

Tip: Looking for answers? Try searching our database.

Lock Form after press a button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adamfunchal - 25 May 2007 12:15 GMT
Hello
I have a form with a button to send him by e-mail to another person. When I
press that Button it opens a Report and send this report by mail. Now my
question is:
Its possible lock that form  after press "e-mailButton" and its successfully
send by mail?Could that e-mailButton be used again when I press "New
Registry" with new auto number?
Scott McDaniel - 25 May 2007 16:53 GMT
>Hello
>I have a form with a button to send him by e-mail to another person. When I
[quoted text clipped - 3 lines]
>send by mail?Could that e-mailButton be used again when I press "New
>Registry" with new auto number?

You can "lock" the form by setting the AllowAdditions, AllowEdits, and AllowDeletions property of the form as needed.
You'd do this AFTER the email is sent:

<your email code>
Me.AllowEdits=False
Me.AllowDeletions=False

You'd need to reset those properties in the Form's Current event, however, in order for users to be able to interact
with other records (if that's relevant).

However, if you want to "save" this setting, you'll need some column in your table that lets you know when the email has
been sent ... for example, if you have a dteEmailSent field to store the date, you could check that in the Current event
and see if the form needs to be "locked".

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
Adamfunchal - 28 May 2007 09:51 GMT
Hello
I've this code for the "emailButton"
Private Sub Comando37_Click()
On Error GoTo Err_Comando37_Click

   Dim stDocName As String

   stDocName = "Enviar por correio"
   DoCmd.RunMacro stDocName
   Me.AllowEdits = False
   Me.AllowDeletions = False

Exit_Comando37_Click:
   Exit Sub

Err_Comando37_Click:
   MsgBox Err.Description
   Resume Exit_Comando37_Click
   
End Sub

And its not working correctly. After press "Commando37" (emailButton) I can
Edit, delete or whatever I want.
Whats Wrong?

> >Hello
> >I have a form with a button to send him by e-mail to another person. When I
[quoted text clipped - 21 lines]
> scott@takemeout_infotrakker.com
> www.infotrakker.com
Adamfunchal - 31 May 2007 09:11 GMT
Someone can Help me?
Thanks
Scott McDaniel - 31 May 2007 10:58 GMT
>Hello
>I've this code for the "emailButton"
[quoted text clipped - 20 lines]
>Edit, delete or whatever I want.
>Whats Wrong?

What does your macro "stDocName" do?

The code you have listed would NOT allow Edits or Deletions, but would allow new records to be added.

If you'd rather, you could instead disable and lock all controls after running your macro:

Dim ctl As Control

On Error Resume Next
For each ctl in Me.Controls
 ctl.Enabled = False
 ctl.Locked = True
Next ctl

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
Adamfunchal - 31 May 2007 16:12 GMT
"What does your macro "stDocName" do?"
this macro opens a report and then send that report by e-mail.
I tried this code:

> Dim ctl As Control
>
[quoted text clipped - 3 lines]
>   ctl.Locked = True
> Next ctl

But it locks everything after "send by mail" but I want to insert a new
registry with new "auto number" and then send again by e-mail.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.