Can a split database have different passwords for Front and Back-end?

E

Edo2008

I created a password for my database and then split it into a front-
end database (forms & reports), and a back-end (tables). I'd like to
secure the back-end WITH A DIFFERENT PASSWORD so the folks who can get
into the front-end cannot access the back-end tables directly... I
want them to be forced to use my forms.

Is this possible?

Thanks
-Ed
 
J

John Spencer

Yes. If you are speaking about the simple password protection. You just need
to change the connection string in the links to use the password for the
backend table.

For instance, the connection string probably looks something like the following.
MS Access;PWD=MyPassword;DATABASE=C:\spencer\Access Databases\TSD
Accounting_be.mdb

You would change the connection string to
MS Access;PWD=DifferentPassword;DATABASE=C:\spencer\Access Databases\TSD
Accounting_be.mdb

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
E

Edo2008

Thanks.... how do I access the connection string to modify it?... if
it is easy, then others can access (and read) it too?? My plan is to
make the front-end a .accde so users can't modify forms and
hopefully not access that connection string :).

-Ed
 
J

John Spencer

You can use VBA to edit the connection string.

Or you can change the password on the backend, remove (delete) all the links
in the front end, and then use get MENU: File: Get external data: link tables
to set up the link correctly. When you attempt to access the password
protected database, you will be asked for the password. Once you supply it,
the connection string for the linked tables will contain the password.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
S

strive4peace

Hi Ed,

adding on to what John said...

you can distribute the FE with NO linked tables -- and prompt the user
for information when the db is opened. If they supply it correctly, you
can link to tables through code -- and then delete the links when the
main (or some hidden) form is closed...

keep in mind that, if they open a query and the tables are gone, it may
get corrupted... and they may need you to replace their FE

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

Edo2008

I understand the route of deleting all tables and re-importing them.
I've tried that on one table and was ablet to access the data...
tables come under a different name and I have to rename them.

THe VBA thing... if I hit Alt-F11, I get the VBA window but not
Code. There's not VBA (connection string) to edit ?!? It's got to
be there somewhere.... :)

And the idea is that I don't want me FE uers to know the back-end
database password because I want them to be limited to accessing the
BE through my forms!

-Ed
 
S

strive4peace

Hi Ed,

"I understand the route of deleting all tables and re-importing them."

with all due respect, that is not what I suggested... anyway, you are
linking not importing...

I am suggesting that you do not save the linked tables in the FE (after
development is done of course) and use code to re-link and delete the
links before you close the database

.... BUT, in order for you to be able to understand the code to do this,
you will need to become more proficient with VBA... are you ready to do
some studying?

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

Edo2008

Sorry if I missunderstood.
I've been fooling with VBA for about 8 years now.... learning enough
to get me by :).
I understand how to create SQL queries in VBA as well as the
"connection string" but I don't see how to create such a connection
for the tables unless you are suggesting that I should modify all my
forms and reports to have custom connection strings? They are
currently pointing to tables which, I believe, are somehow linked to
the BE Tables. I'm just not sure how *THAT* link it implemented or
how to modify THAT connection string to include a password.



-Ed
 
S

strive4peace

Hi Ed,

I will get some code ... meanwhile

1. make a blank database and link to some tables -- save the username
and password

2. put this code into a general module and run it.

this routine changes all the table description properties to the connect
string -- so you can study them.

'~~~~~~~~~~~~~~~~~~~~~
'------------------------------------ ChangeTableDescription_To_Connect
'
' change Table Description to Connect string for linked tables
'
Sub ChangeTableDescription_To_Connect()

'Crystal
'strive4peace2008 at yahoo.com
'July 30, 2008

'NEEDS
' Reference to Microsoft DAO Library

' click HERE
' press F5 to Run

'CALLS
' GetTableDescription
' IsPropertyDefined

On Error GoTo Proc_Err

Dim db As DAO.Database _
, tdf As DAO.TableDef

Dim mDescription As String

Set db = CurrentDb

'loop through all the tables in the current database

For Each tdf In db.TableDefs

'if the table is not linked, skip it
If Not tdf.SourceTableName <> "" Then GoTo NextTdf

mDescription = tdf.Connect

If IsPropertyDefined("Description", tdf) Then
tdf.Properties("Description") = mDescription
Else
tdf.Properties.Append _
tdf.CreateProperty( _
"Description" _
, dbText _
, mDescription)
End If

NextTdf:

Next tdf

'make new table descriptions display immediately
db.TableDefs.Refresh
Application.RefreshDatabaseWindow

MsgBox "Done changing Table Descriptions to Connect String", , "Done"

Proc_Exit:
Set tdf = Nothing
Set db = Nothing

Exit Sub

Proc_Err:

MsgBox Err.Description, , _
"ERROR " & Err.Number _
& " ChangeTableDescription_To_Connect"

Resume Proc_Exit

'if you want to single-step code to find error, CTRL-Break at MsgBox
'then set this to be the next statement
Resume

End Sub

'------------------------------------ GetTableDescription
'
Function GetTableDescription( _
ByVal pTablname As String _
, dbObj As DAO.Database _
) As String

'Crystal
'strive4peace2008 at yahoo.com
'July 25, 2008
'
'PARAMETERS
' pTablname is the name of the table
' dbObj is a database object

'RETURNS
' Table Description if defined
' an empty string (ZLS) if not
'
On Error GoTo Proc_Err

GetTableDescription = ""

Dim prp As DAO.Property

For Each prp In dbObj.TableDefs(pTablname).Properties
If prp.Name = "Description" Then
GetTableDescription = prp
GoTo Proc_Exit
End If
Next prp

Proc_Exit:
Set prp = Nothing
Exit Function


Proc_Err:
MsgBox Err.Description, , _
"ERROR " & Err.Number _
& " GetTableDescription"

Resume Proc_Exit
Resume

End Function


'------------------------------------ IsPropertyDefined
'
' this is a generic function to see if
' a property is defined
' passed object can be a Table, Field, Database, ...
'
Function IsPropertyDefined( _
ByVal pPropName As String _
, Optional ByVal Obj As Object _
) As Boolean

'Crystal
'strive4peace2008 at yahoo.com
'June 20, 2008
'
'PARAMETERS
' Obj can be a database, a Tabledef, a Field...
' if it is missing, CurrentDb is used

On Error GoTo Proc_Err

IsPropertyDefined = False

Dim prp As DAO.Property

If Obj Is Nothing Then
Set Obj = CurrentDb
End If

For Each prp In Obj.Properties
If prp.Name = pPropName Then
IsPropertyDefined = True
GoTo Proc_Exit
End If
Next prp

Proc_Exit:
Set prp = Nothing
Exit Function


Proc_Err:
MsgBox Err.Description, , _
"ERROR " & Err.Number _
& " IsPropertyDefined"

Resume Proc_Exit

'if you want to single-step code to find error, CTRL-Break at MsgBox
'then set this to be the next statement
Resume

End Function
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

Edo2008

Interesting.... The new "Description" property now shows the
connection string which has the password to the BE database.
interesting... but I'm curious what the next step is... Should I
modify that string and put it back in its CONNECT property?
Intereting..... Coooooool :). Definately not a straight-
forarward approach :).

-Ed
 
S

strive4peace

Hi Ed,

"unless you are suggesting that I should modify all my
forms and reports to have custom connection strings? "

no ... when the database is opened and the user puts in their
credentials -- if they have the right permissions, then the back-end
tables will be linked by code. You will keep a form open (can be
hidden); this form will be the last thing to close --and when it does,
you would delete all the linked tables, then exit Access

I gave you code to study so you can become familiar with your connection
strings.

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
S

strive4peace

Hi Ed,

"Should I > modify that string and put it back in its CONNECT property?"

no, I will get you some code -- probably tomorrow though, it is getting
late here -- just wanted to give you something you can study to take the
mystery out of connect strings <smile>

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
S

strive4peace

oops! I modified some code I had to change table descriptions to the
source table descriptions in the back-end ... what I just posted does
NOT call GetTableDescription or have need for that code...only
ChangeTableDescription_To_Connect and IsPropertyDefined

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

Edo2008

This may be getting long for this group... feel free to take this
offline at landau at skiz net dot.

That last part where you talk about removing all the tables every time
you shut down.... yayks... that's scary. I thought there'd be a way
you could just tell Access what the password for the Back-End database
is... just once ! If we take this offline... I'll have infomration
that'll amuse you !

-Ed
 
E

Edo2008

Oh.. one more thing... I'm thinking of using SQL Server Express
Edition for the back-end just because it has transaction logging but
that seems like overkill for a 1-person (part time at that)
chiropractic business :).... so I'll stick with the Access back-end of
now.

-Ed
 
S

strive4peace

Hi Ed,

alternately, you can NOT put the password into the connect string --
and they will be prompted each time the database is opened. It is your
choice.

You can change a connect string like this:

currentdb.tabledefs(tablename).connect = "something"

take the password out and see what happens ... is that what you want to
do? It is totally up to you <smile>

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
S

strive4peace

Hi Ed,

tell me which way you want to go -- and if you need code, we can help
you out.

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
E

Edo2008

The whole point is that I want to prevent users from accessing the
tables themselves. I therefore do *NOT* want them to have the back-
end password. I therefore need to permanently set the back-end
password into the front-end. I will then make the front-end into
a .accde (binary) so hopefully they won't be able to extract the
password.

Ideally, I do this once and it is stored somehow in all the tables.
I'm scared of writing something which will re-link all the tables each
time the front-end is started... that just scares me :).


-Ed
 
E

Edo2008

Also.... would you recommend going with an SQL Server Express back-
end? It sounds like overkill for a 1-person company but the
transaction logs are really appealing !! I want to make this EASY !
-Ed
 
S

strive4peace

Hi Ed,

if you do NOT save the password in the connect string, they will be
prompted for it -- I believe this is what you want ...

try it! in your test database, link to a protected back-end table and
do NOT save the password.

Then, close the database an open it again...

Warm Regards,
Crystal

remote programming and training

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 

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