473,396 Members | 2,068 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,396 software developers and data experts.

Form "ReadOnly"

Hi,
since assigned "acFormReadOnly", my code supposes to allow user to only "read the form", but when I test the code, I can type and click on any of the fields on the form. What I really want the code to do is not allow user to be able to click or type on any of the fields, on the form. Any idea? please help.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim db As Database
  3.     Dim rst As Recordset
  4.     Dim stLinkCriteria As String
  5.  
  6.     Set db = CurrentDb
  7.     Set rst = db.OpenRecordset("tblReview", dbOpenDynaset)
  8.     rst.FindFirst "[ID] = " & Me![txtRECID] & ""
  9.     stLinkCriteria = "[ID]=" & Me![txtRECID]
  10.     DoCmd.OpenForm "frmReview", , , stLinkCriteria, acFormReadOnly
  11.  
thanks!
Sep 25 '08 #1
5 4115
NeoPa
32,556 Expert Mod 16PB
Opening the form ReadOnly only stops you updating the data. It doesn't disable the functionality of the controls on the form.

To do this loop through all the controls and set them to disabled. Some code similar to the following would be required :
Expand|Select|Wrap|Line Numbers
  1. Dim ctlMe As Control
  2.  
  3. On Error Resume Next
  4. For Each ctlMe in Me.Controls
  5.   ctlMe.Enabled = False
  6. Next ctlMe
  7. On Error GoTo 0
This all assumes you can't simply set them all from Design-mode. If that's possible it's much easier. Unfortunately, even .Locked controls still drop down even though their values won't change.
Sep 25 '08 #2
thanks for your help. Is there a way to do ViewOnly instead of ReadOnly?
thanks!

elaine
Sep 25 '08 #3
hjozinovic
167 100+
Try using:
Expand|Select|Wrap|Line Numbers
  1. Set rst = db.OpenRecordset("tblReview", dbOpenSnapshot)
Sep 25 '08 #4
NeoPa
32,556 Expert Mod 16PB
Elaine, you're not being very clear about what you need here I'm afraid.

There is no way to set an otherwise updatable form to read/only simply by setting something in the form. At least not so that the ComboBox controls are disabled from opening. Opening it with DataMode:=AcFormOpenDataMode will ensure the data isn't changed, but the ComboBoxes will still drop down

To stop them dropping down they need to be set .Enabled = False. This will also show them as dimmed on a grey background.

I hope this answers your question. If not, please specify it a little more clearly & I will be better able to help.
Sep 25 '08 #5
DonRayner
489 Expert 256MB
Add your form as a subform on a new form. Delete the subform label and set the subform properties as follows

Special Effect = Flat
Border Style = Transperent
Enabled = No

This will do exactly what you are asking. User will not be able to click onto anything contained in that subform.
Sep 25 '08 #6

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

Similar topics

2
by: G Dean Blake | last post by:
I have a textbox in an ItemTemplate of a grid I'm using to allow users to change a value. I've done it a hundred times. In this project I have it returns the original amount even though the user...
5
by: woodpecker | last post by:
when I set the datagrid's readonly=true,I can't set it back to false value,why? Anybody can tell me the reason? Thanks your help. Woodpecker.
1
by: woodpecker | last post by:
when I set readonly=true,I can't set it back to the value "false",why? Anybody can tell me the reason and fix the problem? Thanks advance. Woodpecker.
2
by: Marcin Floryan | last post by:
I am creating a custom control (Inherits UserControl) and my control containt a TextBox control. TextBox control has a Property called "ReadOnly". I would like to expose this property outside my...
2
by: Daren Hawes | last post by:
Hi I need to add an attribute to a Textbox to make it read only. To add a CSS I use DeptDate.Attributes("Class") = "textInput" That adds 'Class="textinput"', but the readonly is like..
4
by: Dany P. Wu | last post by:
Hi everyone, I'm not entirely sure if this is the best way of going about it, but here's the scenario.......... I have two datagrid, each bound to a datatable which have checkbox columns....
5
by: Alex | last post by:
Hello, Is it possible to have a class that has "readonly" properties for some classes and can be written by others? The reason I want this is that some of my classes need to expose their...
4
by: dc15 | last post by:
For an intro to VB project I have to write a program which takes an amount of Miles, Yards, and Inches.....and converts it to metric (KM, M, and CM) when all values are entered to the input text...
1
by: mark | last post by:
Forgive me if this seems like a stupid question but I need help... I'm trying to do a simple online form that emails me the results from a few fields. Here is the code: <form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.