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