473,753 Members | 6,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to detect mode of opened form

Hi All,

In AccessXP on the main menu screen I give the user the option to open
this form in either
Edit or Read-Only mode. When the user chooses read-only which I use the
following line

DoCmd.OpenForm "frmLookupAgenc yContactInfo", , , , acFormReadOnly, ,
strSQL

when that form opens I want to detect what mode it opened in Read-Only
or Edit, what's
the vba code that I would use in the On Open event.

I'm already using the open args to pass the sql string which is used as
the record source
so I can't use it to pass anything that I could then check to determine
which mode.
thanks
bobh.

Oct 24 '06 #1
2 10118
On 24 Oct 2006 10:37:13 -0700, bobh wrote:
Hi All,

In AccessXP on the main menu screen I give the user the option to open
this form in either
Edit or Read-Only mode. When the user chooses read-only which I use the
following line

DoCmd.OpenForm "frmLookupAgenc yContactInfo", , , , acFormReadOnly, ,
strSQL

when that form opens I want to detect what mode it opened in Read-Only
or Edit, what's
the vba code that I would use in the On Open event.

I'm already using the open args to pass the sql string which is used as
the record source
so I can't use it to pass anything that I could then check to determine
which mode.
thanks
bobh.
Code the second form's Open event:

If Me.AllowEdits = False then
MsgBox "Read Only"
Else
MsgBox "Edits allowed"
End If

You could also pass more than one OpenArg by concatenating a string
separated by perhaps a vertical line, then split the string in the
second form's Load event:

DoCmd.OpenForm "frmLookupAgenc yContactInfo", , , , acFormReadOnly, ,
strSQL & "|ReadOnly"

Code the load event:
Dim strA as String
Dim strB as String
strA = left(Me.OpenArg s,InStr(Me.Open Args,"|")-1)
strB = Mid(Me.OpenArgs ,InStr(Me.OpenA rgs,"|")+1)

If strB = "ReadOnly" Then etc.......
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Oct 24 '06 #2
Hi Fred,
Thanks for your reply, I think I'll pass another argument in the
openargs as you suggested.
bobh.

On Oct 24, 2:16 pm, fredg <fgutk...@examp le.invalidwrote :
On 24 Oct 2006 10:37:13 -0700, bobh wrote:


Hi All,
In AccessXP on the main menu screen I give the user the option to open
this form in either
Edit or Read-Only mode. When the user chooses read-only which I use the
following line
DoCmd.OpenForm "frmLookupAgenc yContactInfo", , , , acFormReadOnly, ,
strSQL
when that form opens I want to detect what mode it opened in Read-Only
or Edit, what's
the vba code that I would use in the On Open event.
I'm already using the open args to pass the sql string which is used as
the record source
so I can't use it to pass anything that I could then check to determine
which mode.
thanks
bobh.Code the second form's Open event:

If Me.AllowEdits = False then
MsgBox "Read Only"
Else
MsgBox "Edits allowed"
End If

You could also pass more than one OpenArg by concatenating a string
separated by perhaps a vertical line, then split the string in the
second form's Load event:

DoCmd.OpenForm "frmLookupAgenc yContactInfo", , , , acFormReadOnly, ,
strSQL & "|ReadOnly"

Code the load event:
Dim strA as String
Dim strB as String
strA = left(Me.OpenArg s,InStr(Me.Open Args,"|")-1)
strB = Mid(Me.OpenArgs ,InStr(Me.OpenA rgs,"|")+1)

If strB = "ReadOnly" Then etc.......
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -- Show quoted text -
Oct 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1205
by: anthony | last post by:
Hi, I have a button (Button1) to open the main form. If I want to have another button to close this opened form, how do I do it without making Mainform a global variable? Thanks! Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
1
1057
by: Maileen | last post by:
Hi, I would like to know how can i detect if a particular form is not already running ? i have a MDI application and some MID child..but i do not want to have 100 MDI child of the same form, so i need to control it. please, let me know how to detect is form FSLA is already running or not. thanks, Maileen
2
1239
by: John | last post by:
Hi How can I check in code if a form is currently open i.e. running? Thanks Regards
3
5902
by: questionit | last post by:
Hi All How to bring an already opened form in front of all other forms ? Anyone with any ideas please? Thanks Qi
6
2236
by: Steve | last post by:
Hi All I have an on-screen keyboard within a POS program I have written in VB.net 2005, for touch screen computers I have it set to 'always on top' so the user can move the cursor to different text boxes and type using the on-screen keyboard The keyboard launches via the mouseclick event for any text box If another form is launched, with the onscreen keyboard still visible, the
36
5397
by: Don | last post by:
I wrote an app that alerts a user who attempts to open a file that the file is currently in use. It works fine except when the file is opened by Notepad. If a text file is opened, most computers are configured to use Notepad to open the file by default and if they are configured to use Notepad by default I want it to remain that way rather than retrieve the text into my app or force the user to use another app to read the file. I'm...
5
37140
by: bullfrog83 | last post by:
I have a login form. If a user enters the correct username and password I want to open certain forms and close the login form (among other things) when the Sign In button is clicked. I have this code in the cmdSignIn_Click() event: DoCmd.OpenForm "f_Families" DoCmd.OpenForm "f_GiftProcessing" DoCmd.OpenForm "f_Reports" DoCmd.OpenForm "f_SysMaintenance" DoCmd.Close acForm, "f_Login"
0
9072
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, 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...
0
8896
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9451
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9421
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,...
0
8328
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6869
isladogs
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...
0
4771
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...
1
3395
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
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.