473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Making a database temporarily read only

Hi,
I have a database which is able to show projects which are current and those which are archived. The users need to be able to search the archived data but are not allowed to edit it in anyway. I can use allowedits etc to make the forms read-only but this also affects the two combo boxes that are used to search for the projects by name and project id. I need to find a way to temporarily make the database read only whilst retaining the functionality of the controls on the forms. I am not able to close and re-open the database as other users will be using it to view current projects whilst others will be viewing archived. Splitting the database into two is not viable as some projects whilst archived are linked to other projects which are not and rely on common data files.
Any suggestions would be really welcome
Thanks
Jan 22 '08 #1
3 2085
Jim Doherty
897 Expert 512MB
Hi,
I have a database which is able to show projects which are current and those which are archived. The users need to be able to search the archived data but are not allowed to edit it in anyway. I can use allowedits etc to make the forms read-only but this also affects the two combo boxes that are used to search for the projects by name and project id. I need to find a way to temporarily make the database read only whilst retaining the functionality of the controls on the forms. I am not able to close and re-open the database as other users will be using it to view current projects whilst others will be viewing archived. Splitting the database into two is not viable as some projects whilst archived are linked to other projects which are not and rely on common data files.
Any suggestions would be really welcome
Thanks
Hi Jules,

Do you have field that determines if a record is archived lets say a tick box or a date field or some other indicator that flags the record as an archived record? if so then 'one' way would be for you to explore the 'conditional formatting' side of access for screen controls and base formatting logic on your archive field value to enable or disable controls accordingly. (Form design...menubar...conditional formatting)

Jim :)
Jan 22 '08 #2
missinglinq
3,532 Expert 2GB
I've read your post several times and I'm still having a hard time understanding exactly what you're doing, but it sounds, from some of your comments, as if you have separate form(s) for viewing the archived data. What you need to do, rather than make an entire form read-only, is to only lock the group of controls that you don't want edited.

The way you "group" controls for this kind of manipulation is to use the little known Tag Property. Select the control(s) then got to Properties - Other and enter a value in the Tag Property. Don't get confused if you see a SmartTag Property! This is something else entirely!

For the purposes of this demo, we'll make the Tag Property

Marked

Enter this in the Tag Property box (without quotation marks.)

Also, for purposes of this demo, we'll change the Locked Property of the tagged controls to Locked = False. You can, of course, use the code to set any property that the particular control type has.

Then, use this code.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim ctrl As Control
  3.  
  4. For Each ctrl In Me.Controls
  5.     If ctrl.Tag = "marked" Then
  6.        ctrl.Locked = False
  7.     End If
  8.   Next
  9.  
  10. End Sub
Be sure that the controls that are tagged actually have the property you're trying to change, or you'll get an error! For instance, tagging a label control and then trying to change the Locked property will error out, because labels don't have an Locked property.

The really nice thing is that you can have multiple levels within a form, i.e. several different Tags being used to identify different groups of controls to be manipulated.

If you were viewing active and archived records in the same form, you could use a variation of this to implement Jim's idea.

Welcome to TheScripts!

Linq ;0)>
Jan 22 '08 #3
Missinglinq,
many thanks for your input and help here. I've inherited this project mid way through its development and making some changes are not going to be easy. The project sits on 18 different forms most with sub and sub/sub forms.
Jan 23 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
1
by: Bridget Willey | last post by:
I am using ACT 6 and am trying to "split" the database between records for customers and junk records. The accounts designated as "customers" have that word in the ID field, and I am using that...
5
by: kai | last post by:
Hi, All I try to block some one import my Access database tables using Access database. I used password protection, but if some one crack through my password, are there any other methods to...
6
by: Jerry Spence1 | last post by:
Why doesn't the following work in my ASP program? I have imported ADOX I am trying to create a temporary database on the user's PC. The example is taken from Microsoft. Dim cat As Catalog =...
351
by: CBFalconer | last post by:
We often find hidden, and totally unnecessary, assumptions being made in code. The following leans heavily on one particular example, which happens to be in C. However similar things can (and...
11
by: bgreen | last post by:
I am hoping for some assistance with formatting a large text file which consists of a series of individual records. Each record includes specific labels/field names (a sample of 1 record (one of...
5
by: djhexx | last post by:
Hello. I have an ASP.NET application (C#) that I allow users to upload files. Files get stored in a SQL2005 database. The file data is stored in a varbinary(max) column. When the user uploads...
37
by: Vince C. | last post by:
Hi all. I've installed Bloodshed Dev-C++ on a Windows 2000 SP4 machine. I'm using MinGW 3.4.2. I'd like to temporarily disable standard functions to write to stderr, i.e. for instance...
50
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.