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. -
-
Dim db As Database
-
Dim rst As Recordset
-
Dim stLinkCriteria As String
-
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("tblReview", dbOpenDynaset)
-
rst.FindFirst "[ID] = " & Me![txtRECID] & ""
-
stLinkCriteria = "[ID]=" & Me![txtRECID]
-
DoCmd.OpenForm "frmReview", , , stLinkCriteria, acFormReadOnly
-
thanks!
5 4152 NeoPa 32,572
Recognized Expert Moderator MVP
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 : - Dim ctlMe As Control
-
-
On Error Resume Next
-
For Each ctlMe in Me.Controls
-
ctlMe.Enabled = False
-
Next ctlMe
-
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.
thanks for your help. Is there a way to do ViewOnly instead of ReadOnly?
thanks!
elaine
Try using: - Set rst = db.OpenRecordset("tblReview", dbOpenSnapshot)
NeoPa 32,572
Recognized Expert Moderator MVP
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:=AcFor mOpenDataMode 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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 enters a revised value in
the textbox. the code is identical to my many working examples.
However, I notice that the xml dataset that the grid is binding from I am
using has msdata:ReadOnly="true" generated in it. I can't see how or why
that...
|
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.
|
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.
|
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 own control, but
it seems impossible because when I write:
Public Property ReadOnly() as Boolean
....
The compilter treats ReadOnly as a Modifier and does not allow this
contruct. Can I expose a property of my control under a different name...
|
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..
| |
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.
There are two buttons between the datagrids, "Add" and "Remove". They
basically remove rows from one grid to the other, only those with the
checkbox ticked.
|
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
"status", but I need to be ensure that this is only updated by the class
that "owns" them, and is not updateable by anything else. Also, I'd rather
these classes pass their "status" by reference instead of by value, so any
other object querying this...
|
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 boxes it works
fine, but if there is a number missing I get the following error:
An unhandled exception of type 'System.InvalidCastException' occurred
in microsoft.visualbasic.dll
Additional information: Cast from string "" to type 'Double' is...
|
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 action="http://cm1web1/WebSurveyComponents/script/
processform.asp" method="post">
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |