473,396 Members | 2,033 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.

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 "frmLookupAgencyContactInfo", , , , 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 10060
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 "frmLookupAgencyContactInfo", , , , 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 "frmLookupAgencyContactInfo", , , , acFormReadOnly, ,
strSQL & "|ReadOnly"

Code the load event:
Dim strA as String
Dim strB as String
strA = left(Me.OpenArgs,InStr(Me.OpenArgs,"|")-1)
strB = Mid(Me.OpenArgs,InStr(Me.OpenArgs,"|")+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...@example.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 "frmLookupAgencyContactInfo", , , , 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 "frmLookupAgencyContactInfo", , , , acFormReadOnly, ,
strSQL & "|ReadOnly"

Code the load event:
Dim strA as String
Dim strB as String
strA = left(Me.OpenArgs,InStr(Me.OpenArgs,"|")-1)
strB = Mid(Me.OpenArgs,InStr(Me.OpenArgs,"|")+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
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...
1
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...
2
by: John | last post by:
Hi How can I check in code if a form is currently open i.e. running? Thanks Regards
3
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
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...
36
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...
5
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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
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...
0
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...

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.