Newbie q: Can't modify a database

J

Jon Hendry

Hi,

I've been handed an access database in order to modify it (in the
programming sense), but when i open it it opens as an application,
without any apparent means of modifying the database structure. All it
will let me do is add or edit data.

Is there a secret trick to opening the database for modification, or
do I have to go to the owners of the database and have them save it in
a different way?

Thanks,

Jon
 
G

Graham Mandeno

Hi Jon

If you hold down the shift key while the database is opening it should
bypass any startup options code and take you straight to the database
window.

If this doesn't work, then the shift key has been disabled, and the fix is
more involved, so post back here if you still have a problem.
 
J

Jeff Boyce

Jon

Can you confirm that what you have is an ".mdb" file, and not an ".mde"
(which is not modifiable)?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I

IRS Intern

Jeff

i've heard of a lot of people that make it into a MDE and then they
change the extension back to MDB
have you ever heard of this?

any other way to tell if it's really a MDB or a MDE?

-Aaron
 
T

Tom Wannabe

consider yourself lucky

MDB randomly loses data

move to SQL SErver and Access Data Projects
 
J

Jon Hendry

Graham,

This worked like a charm! Thanks!

Hi Jon

If you hold down the shift key while the database is opening it should
bypass any startup options code and take you straight to the database
window.

If this doesn't work, then the shift key has been disabled, and the fix is
more involved, so post back here if you still have a problem.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand


I've been handed an access database in order to modify it (in the
programming sense), but when i open it it opens as an application,
without any apparent means of modifying the database structure. All it
will let me do is add or edit data.
Is there a secret trick to opening the database for modification, or
do I have to go to the owners of the database and have them save it in
a different way?

Jon
 
G

Guest

Hi,
I am also a newbie, I tried the shift key while opening the .mdb file but it
won't open in edit mode. Is there another way?
Thanks
 
G

Graham Mandeno

Hi Frank

It sounds like, at some stage, someone has run some code to disable the
"bypass key" (shift key). This is done by creating a database property
named "AllowBypassKey" and setting it to False.

To undo it, you need to set that property to True, but as you can't get into
the database to edit code, it has to be done from the outside.

Here is a good general-purpose function for setting properties on objects:
=========== start code ===============
Public Function SetProperty(obj As Database, _
PropName As String, PropVal As Variant, _
Optional PropType As DataTypeEnum = dbText, _
Optional AdminOnly As Boolean) As Long
Dim prop As DAO.Property
On Error GoTo ProcErr
Set prop = obj.Properties(PropName)
If prop.Type = PropType And Not AdminOnly Then
prop.Value = PropVal
Exit Function
Else
obj.Properties.Delete PropName
End If
CreateTheProperty:
Set prop = CurrentDb.CreateProperty(PropName, PropType, _
PropVal, AdminOnly)
obj.Properties.Append prop
ProcEnd:
Set prop = Nothing
Exit Function
ProcErr:
With Err
If .Number = 3270 Then Resume CreateTheProperty
SetProperty = .Number
.Raise .Number, .Source, "Error setting property " & PropName _
& vbCrLf & .Description, .HelpFile, .HelpContext
End With
Resume ProcEnd
End Function
============== end code ================

You will need to create a new database and open a new module into which you
paste this function.

Then add another procedure to open your database and set the property:

============== start code ============
Public Sub EnableBypassKey()
Dim db as DAO.Database
Set db = DBEngine.OpenDatabase("<insert here the path to your database>")
SetProperty db, "AllowBypassKey", True, dbBoolean, True
db.Close
End Sub
============= end code ===============

Now, just position the cursor anywhere in this procedure and press the F5
key to run it. Now you should be able to use the shift key.
 

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