Hi Robert,
In the code in your frmForm1 form, open the frmForm2 button with and without
supplying an optional OpenArg statement. For example:
If a = True then
DoCmd.Openform "frmForm2" '<---No OpenArg argument included
Else
DoCmd.Openform "frmForm2", OpenArgs:="Hello World"
End If
Add the following Form_Open event procedure to frmForm2:
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
On Error GoTo ProcError
If Not IsNull(Me.OpenArgs) Then
Me.NavigationButtons = False
Me.RecordSelectors = False
Else
Me.NavigationButtons = True
Me.RecordSelectors = True
End If
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in Form_Open event procedure..."
Resume ExitProc
End Sub
I have a working example that you can download, if you'd like. In this case,
frmForm1 would be the Query By Form that is the startup form,
"2frmQueryByFormExample", and frmForm2 would be my "frmMovieTitles" form. If
you open frmMovieTitles by itself, you will see the record selector and the
navigation buttons. However, if you open this same form by double-clicking a
record in the QBF form, you will not see the record selector or navigation
buttons. Here is a link to the download:
http://home.comcast.net/~tutorme2/samples/Chap08QBF.zip
Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________