By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,816 Members | 2,053 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,816 IT Pros & Developers. It's quick & easy.

how to detect mode of opened form

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.