Database security

N

Nick T

Hi,
I have a database for which i want to make difficult for users to alter -
without going over the top.
What i find is a great way (and suitable for my use) is to change the
settings in the 'Tools - Start up' menu and 'uncheck' all the tick boxes and
set a specific form to open when the db is loaded. Iv done this and all
works great! However...... on one of my forms, i have a cmd button which
prints a form. But when this is clicked my main Database Window (which was
hidden) appears, my form is printed and then my Database Window remains
showing - this then would allow for people to tinker with my db!!

Any suggestions on how i can get around this problem??
For info, the code behind my cmd button is:


Private Sub Command55_Click()
On Error GoTo Err_Command55_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "Line1"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_Command55_Click:
Exit Sub

Err_Command55_Click:
MsgBox Err.Description
Resume Exit_Command55_Click

End Sub


Any suggestions greatly appreciated.

Many thanks
 
B

BruceM

You would do better to print a report rather than a form. Report's are
meant to be printed. You can print a report, but it tends to be more work,
and offers less flexibility.. You can save a form as a report. Use
something like this code to print the report:

Dim stDocName As String

stDocName = "ReportName"

DoCmd.OpenReport stDocName

Since you haven't specified acPreview (after stDocName) the report prints
and closes. One line of code and you're done.

I'm not familiar with Select Object, but I suspect the True argument is
leaving the database window open. Perhaps you would need to repeat the line
of code with the False argument after printing, but that's just a guess. If
you use a report you won't have to think about it.
 

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